高校学生管理系统c++
时间: 2023-12-30 09:06:02 浏览: 36
以下是一个用C++语言编写的高校学生信息管理系统的简单示例:
```cpp
#include <iostream>
#include <string>
using namespace std;
class Student {
private:
string;
int age;
string major;
public:
void setName(string n) {
name = n;
}
void setAge(int a) {
age = a;
}
void setMajor(string m) {
major = m;
}
void displayInfo() {
cout << "Name: " << name << endl;
cout << "Age: " << age << endl;
cout << "Major: " << major << endl;
}
};
int main() {
Student student;
string name, major;
int age;
cout << "Enter student name: ";
cin >> name;
student.setName(name);
cout << "Enter student age: ";
cin >> age;
student.setAge(age);
cout << "Enter student major: ";
cin >> major;
student.setMajor(major);
cout << endl << "Student Information:" << endl;
student.displayInfo();
return 0;
}
```
这个程序实现了一个简单的高校学生信息管理系统。用户可以输入学生的姓名、年龄和专业,并显示学生的信息。