我的问题看起来很简单,我很抱歉问,但是这个代码有什么问题?为什么只是跳过名字部分?为什么我的“获取”函数不能真正得到一个字符串?
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define nl printf("\n")
struct date{int day,month,year;};
struct student{long int id;char name[30];struct date birthday;};
int main()
{
struct student temp;
nl;nl;printf("ID no:");scanf("%ld",&temp.id);nl;
printf("Student name:");
gets(temp.name);
nl;nl;
printf("Student birthday year:19");scanf("%d",&temp.birthday.year);nl;
printf("Student birthday month");scanf("%d",&temp.birthday.month);nl;
printf("Student birthday day");scanf("%d",&temp.birthday.day);nl;
getch(); //for pause
return 0;
}
获取函数有什么不对吗?!因为我不想使用scanf("%s",)
因为空间的原因...
关于_“学生生日年:19”_,你写这本世纪了吗? – ryyker
我是一个新的程序员抱歉没有知识... – amfad33
'#define nl printf(“\ n”)'是可怕的C,并且不应该在程序中。 – abelenky