看图做题!!!C++程序设计题目谢谢大佬!完整程序鸭

C++完整程序设计,按照图片题目要求!

第1个回答  2019-01-29
#include<iostream>
#include <string.h>
#include <list>
using namespace std;
class Student{
public:
Student(string name){
m_name = name;
}

string m_name;
int m_age;
};
class School{
public:
School(){
schoolname = "name";
fee = 100;
cnt = 0;
}

bool Register(Student s, double fee){
cout <<"Register "<< s.m_name<<endl;
}

void Train(Student s){
cout <<"Train "<<s.m_name<<endl;
}

string schoolname;
double fee;
list<Student*> l;
int cnt;
};
int main(){
School s;

string str;
while(true){
cin>>str;
char c[1024] = {0};
sscanf(str.c_str(),"%[a-zA-Z]",c);
if(str.length() == strlen(c)){
Student *pSt = new Student(str);
s.Register(*pSt,100);
s.Train(*pSt);
}else{
break;
}
}
return 0;
}
相似回答