标题:各位大虾们帮忙看下那错了!!
只看楼主
wjcl122791
Rank: 1
来 自:四川达州
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-5-5
结帖率:100%
 问题点数:0 回复次数:3 
各位大虾们帮忙看下那错了!!
#include <stdio.h>
#include <stdlib.h>
struct stud_tpye
{char name[20];
   long num;
   int age;
   char sex;
   };
   
main()
{
   struct stud_tpye student[1],*p;
   int i;
   char numstr[20];
   for (i=0,p=student;i<1;p++,i++)
   {printf("Enter all data of student[%d]:\n",i);
      scanf("%s%ld%d%c",p->name,&p->num,&p->age,&p->sex);
      }
      for (i=0,p=student;p<student+1;p++,i++);
      printf("%3d%-20s%8ld%6d%3c\n",i,p->name,p->num,p->age,p->sex);
   
}
搜索更多相关主题的帖子: long 
2011-05-28 21:54
liangjinchao
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:376
专家分:697
注 册:2010-11-8
得分:0 
程序代码:
#include <stdio.h>
#include <stdlib.h>
struct stud_tpye
{char name[20];
   long num;
   int age;
   char sex;
   };
   
main()
{
   struct stud_tpye student[1],*p;
   int i;
   char numstr[20];
   for (i=0,p=student;i<1;p++,i++)
   {
        printf("Enter all data of student[%d]:\n",i);
        scanf("%s%ld%d%c",p->name,&p->num,&p->age,&p->sex);
    }
    for (i=0,p=student;p<student+1;p++,i++);//<---多了个分号!!!!!!!!!
      printf("%3d%-20s%8ld%6d%3c\n",i,p->name,p->num,p->age,p->sex);
   
}

因为有了因为,所以有了所以,既然已成既然,何必再说何必
2011-05-28 22:08
shen5818
Rank: 2
等 级:论坛游民
帖 子:5
专家分:16
注 册:2011-2-13
得分:0 
for (i=0,p=student;p<student+1;p++,i++); 多了个分号。for (i=0,p=student;p<student+1;p++,i++)
2011-05-28 22:14
wjcl122791
Rank: 1
来 自:四川达州
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-5-5
得分:0 
谢谢哈
2011-05-29 23:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-341268-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.319437 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved