程序如下:
#include "stdafx.h"struct PERSON // Declare PERSON struct type
{
int age; // Declare member types
long ss;
float weight;
char name[25];
};PERSON brother, aa; // C++ style structure declaration
brother.age = 13; // 这句编译出现问题,问题如下:int main(int argc, char* argv[])
{
return 0;
}编译出错如下:
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2143: syntax error : missing ';' before '.'
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2501: 'brother' : missing storage-class or type specifiers
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2371: 'brother' : redefinition; different basic types
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(12) : see declaration of 'brother'
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2143: syntax error : missing ';' before '.'
#include "stdafx.h"struct PERSON // Declare PERSON struct type
{
int age; // Declare member types
long ss;
float weight;
char name[25];
};PERSON brother, aa; // C++ style structure declaration
brother.age = 13; // 这句编译出现问题,问题如下:int main(int argc, char* argv[])
{
return 0;
}编译出错如下:
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2143: syntax error : missing ';' before '.'
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2501: 'brother' : missing storage-class or type specifiers
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2371: 'brother' : redefinition; different basic types
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(12) : see declaration of 'brother'
F:\Data\MyProjects\MyDatabase\Test1\Test1.cpp(14) : error C2143: syntax error : missing ';' before '.'
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货