卡欧斯奥特6兄弟:谁帮我看看这段C语言

来源:百度文库 编辑:高考问答 时间:2024/04/28 23:29:21
我的目的是想要输入几个数据,然后排列出来。但是发现这段程序有两个错误,不知道怎么改,错误如下:
w.c 6:在定义中有太多类型
w.c 23:For 语句缺少‘;’在print函数中
还有两个警告:
w.c 23:可能在‘i’定义以前使用了它在print函数中
w.c 26:参数‘st’从未使用在print函数中

#include <stdio.h>
struct student
{char name[10],col[20],spec[20];
int class[4],buil[2],room[4],tel[11],qq[15];
}
void enter(struct student st[])
{int i;
for (i=0;i++;)
{printf("name:");scanf("%s",st[i].name);
printf("college:");scanf("%s",st[i].col);
printf("speciality:");scanf("%s",st[i].spec);
printf("class:");scanf("%d",st[i].class);
printf("buiding:");scanf("%d",st[i].buil);
printf("room:");scanf("%d",st[i].room);
printf("telephone No. :");scanf("%d",st[i].tel);
printf("QQ:");scanf("%d",st[i].qq);
}
printf("\n");
}
void print(struct student st[])
{int i;
printf("NAME COLLEGE SPECIALITY CLASS BUILDING ROOM TELEPHONE QQ\n");
for (i++)
{printf("%s,%s,%s,%d,%d,%d,%d,%d",st[i].name,st[i].col,st[i].spec,st[i].class,st[i].buil,st[i].room,st[i].tel,st[i].qq);
}
}

邮箱:shenweicool@163.com
QQ:34592358
我就是那么写的,从i=0开始,加1,有错吗?
把那个删了,就变成5个错误了。

一个是i没有初值,第二个for的格式也不正确应该这样写for(i=0; ; i++)

for (i=0;i++;)这句话不对吧?还是你传上来的时候传错了?