C++定义结构体数组出现如下错误
代码如下typedefstruct{intsno;zcoursezc;intcredict;intgrade1;intgrade2;intgrade3;doublezon...
代码如下
typedef struct
{
int sno;
zcourse zc;
int credict;
int grade1;
int grade2;
int grade3;
double zonghe;
double xuefen;
}course[50];
报错信息如下
error C2639: compiler generated default constructor required by unnamed class
看不懂..求高人指导.... 展开
typedef struct
{
int sno;
zcourse zc;
int credict;
int grade1;
int grade2;
int grade3;
double zonghe;
double xuefen;
}course[50];
报错信息如下
error C2639: compiler generated default constructor required by unnamed class
看不懂..求高人指导.... 展开
1个回答
展开全部
typedef struct //去掉typedef
{
int sno;
zcourse zc;
int credict;
int grade1;
int grade2;
int grade3;
double zonghe;
double xuefen;
}course[50];
{
int sno;
zcourse zc;
int credict;
int grade1;
int grade2;
int grade3;
double zonghe;
double xuefen;
}course[50];
更多追问追答
追问
typedef struct
{
string cno;
string cname;
}zcourse;
typedef struct
{
int sno;
zcourse zc;
int credict;
int grade1;
int grade2;
int grade3;
double zonghe;
double xuefen;
}course[50];
去掉之后有其他错误, 都没见过的说....
追答
#include //加这两行试试
using namespace std; //加这两行试试
typedef struct
{
string cno;
string cname;
}zcourse;
struct
{
int sno;
zcourse zc;
int credict;
int grade1;
int grade2;
int grade3;
double zonghe;
double xuefen;
}course[50];
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询