내 문제는 매우 간단하고 묻어서 미안하지만이 코드가 잘못된 것은 무엇입니까?! 왜 그냥 이름 부분을 건너 뛰는거야?!왜 "gets"함수가 실제로 문자열을 얻을 수 없습니까?
#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