马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
这段代码报错是什么原因Compiling...
1.cpp
D:\VC++\Microsoft Visual Studio\MyProjects\3\1.cpp(34) : error C2039: 'birthbay' : is not a member of '__unnamed'
D:\VC++\Microsoft Visual Studio\MyProjects\3\1.cpp(13) : see declaration of '__unnamed'
D:\VC++\Microsoft Visual Studio\MyProjects\3\1.cpp(34) : error C2228: left of '.month' must have class/struct/union type
D:\VC++\Microsoft Visual Studio\MyProjects\3\1.cpp(35) : error C2039: 'birthbay' : is not a member of '__unnamed'
D:\VC++\Microsoft Visual Studio\MyProjects\3\1.cpp(13) : see declaration of '__unnamed'
D:\VC++\Microsoft Visual Studio\MyProjects\3\1.cpp(35) : error C2228: left of '.month' must have class/struct/union type
执行 cl.exe 时出错.
#include <stdio.h>
void main()
{
struct date
{
int month;
int day;
int year;
};
struct
{
int num;
char name[20];
char sex;
struct date birthday;
float score;
} boy1, boy2;
printf("Please input birthday(YY;)");
scanf("%d", &boy1.birthday.year);
printf("Please input birthday(MM:)");
scanf("%d", &boy1.birthday.month);
printf("Please input birthday(DD;)");
scanf("%d", &boy1.birthday.day);
printf("\n");
boy2 = boy1;
printf("boy1's birthday is %d-%d-%d\n", boy1.birthday.year, boy1.birthbay.month, boy1.birthday.day);
printf("boy1's birthday is %d-%d-%d\n", boy2.birthday.year, boy2.birthbay.month, boy2.birthday.day);
}
boy1.birthbay.month 改为 boy1.birthday.month
birthbay 这个单词拼错了
|