| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 330 人关注过本帖
标题:各位大虾们帮忙看下那错了!!
只看楼主 加入收藏
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
快速回复:各位大虾们帮忙看下那错了!!
数据加载中...
 
   



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

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