麻烦各位哥们帮帮忙啊,下面这个string类不会在class里面用,求衣哥们帮忙解决下啊,多谢来了急~~~~
using namespace std;#include <string>
#define NULL 0
class stu
{
private:
int num;
string name;
public:
void display();
};
void display();
void play(class stu *p);
class stu *head=NULL;
int main()
{
display();
return 0;
}
void stu::display()
{
class stu *p1;
p1=new stu;
cout<<"请输入学生信息"<<endl;
cin>>p1->num;
cin>>p1->name;
play(p1);
}
void play(class stu *p)
{
string name;
class stu *p1;
cin>>name;
while(strcmp(name,p->name)==0)
{
cout<<p->num<<endl;
cout<<o->name<<endl;
}
}