嘉兴海顿公馆房价:紧急求助C++问题,在线等候

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 12:04:09
#include"string.h"
struct pmessage
{
string num,name,sex,sclass,add,telenum;
pmessage* next,* front;
};

这个机构有问题吗?
怎么变得时候有:
f:\programs\通讯录\通讯录\student.h(4) : error C2146: syntax error : missing ';' before identifier 'num'
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'string' : missing storage-class or type specifiers
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'num' : missing storage-class or type specifiers
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'name' : missing storage-class or type specifiers
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'sex' : missing storage-class or type specifiers
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'sclass' : missing storage-class or type specifiers
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'add' : missing storage-class or type specifiers
f:\programs\通讯录\通讯录\student.h(4) : error C2501: 'telenum' : missing storage-class or type specifiers

我用的C++是VC6.0的。
有错的话帮我改改,谢谢。

开头改为
#include <string>
using namespace std;

#include"string.h"
struct pmessage
{
string num,name,sex,sclass,add,telenum;
pmessage* next,* front;
}pmessage;
试试看,我也不是很确定。

在头上加#include"string.h"

string类型的声明包含在string 中,而不是string.h中