类和对象

#include

#include

using namespace std;

class Student {

private:

int id;

string name;

int english;

int program;

int math;

public:

void setInformation(int id, const string& name, int english, int program, int math) {

this->id = id;

this->name = name;

this->english = english;

this->program = program;

this->math = math;

}

void showInformation() const {

cout << "ID: " << id << ", Name: " << name << ", English: " << english << ", Programming: " << program << ", Math: " << math << endl;

}

};

int main() {

Student c;

int id, english, program, math;

string name;

cin >> id >> name >> english >> program >> math;

c.setInformation(id, name, english, program, math);

c.showInformation();

return 0;

}

全部评论

相关推荐

积极的小学生不要香菜:你才沟通多少,没500不要说难
点赞 评论 收藏
分享
05-22 12:44
已编辑
门头沟学院 golang
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务