#include<iostream>
using namespace std;
class StudentClass{
friend class Oopclass;
public:
StudentClass();
void setStudentData();
void printStudentScore();
StudentClass* next;
~StudentClass();
private:
string std_ID;
int sID, sMid, sFin, sOP, hw[3];
double sTotal;
};
class OopClass{
friend class StudentClass;
public:
OopClass();
void setOopData();
void printOopScore();
void queryOopScore();
void findOopAverageScore();
void addStudentData();
void deleteStudentData();
void updateStudentData();
~OopClass();
private:
string professor, subject;
int cSn;
double cSAvg;
StudentClass* cSAddr;
};
int main(int argc, char **argv){
OopClass Info[3];
Info[0].setOopData();
return 0;
}
StudentClass::StudentClass(){
}
void StudentClass(){
}
void StudentClass::setStudentData() {
}
StudentClass::~StudentClass(){
}
OopClass::OopClass(){
}
void OopClass::setOopData() {
cout << "Professor?" << endl;
cin >> professor;
cout << "Subject?" << endl;
cin >> subject;
cout << "How many students do you want to input ?" << endl;
int number = 0;
cin >> number;
cSAddr = new StudentClass;
//for(int i = 0; i < number; i ++) setStudentData();
}
OopClass::~OopClass(){
}
当我写累了“cSAddr = new StudentClass;” ,它达到
关于错误
" C:\Users\lypan\Documents\final.cpp 在成员函数 'void OopClass::setOopData()' 中:
63 14 C:\Users\lypan\Documents\final.cpp [错误] 'StudentClass' 之前的预期类型说明符
63 14 C:\Users\lypan\Documents\final.cpp [错误] 从 'int*' 到 'int' 的无效转换 [-fpermissive]
63 14 C:\Users\lypan\Documents\final.cpp [错误] 预期为 ',' 或 ';' 在‘学生班’之前”
而且我不知道为什么我做错了,请告诉我我犯了什么错误。谢谢!