//我写了个草稿,你拿去修改一下吧!
#include
#include
using namespace std;
class Student
{
private:
string xuehao;
string xming;
string shenri;
string nianji;
string banji;
string yuanxi;
string zhuanyi;
public:
//Student();
//Student(string a,string b,string c,string d,string e,string f,string g);
Student(string a="20061500",string b="zhang",string c="86-1-1",string d="06",string e="01",string f="computer",string g="com");
void setinfo();
void show();
};
/*Student::Student()
{
xuehao="1510";
xming="wang";
shenri="87-2-0";
nianji="05";
banji="02";
yuanxi="cailiao";
zhuanyi="huaxue";
}*/
Student::Student(string a,string b,string c,string d,string e,string f,string g)
{
xuehao=a;
xming=b;
shenri=c;
nianji=d;
banji=e;
yuanxi=f;
zhuanyi=g;
}
void Student::setinfo()
{
cout<<"要改动除姓名外的值,请依次输入。共6个值"< string x,s,n,b,y,z;
cin>>x>>s>>n>>b>>y>>z;
xuehao=x;
shenri=s;
nianji=n;
banji=b;
yuanxi=y;
zhuanyi=z;
}
void Student::show()
{
cout< //cout<}
int main()
{
Student stu[5]={
Student(),
Student("20061501","zhao","87-1-1","06","02","computer","ruanjian"),
Student("20061503","qian","87-4-4","06","03","computer","xingan"),
Student("20061504","sun","87-5-8","05","01","cailiao","huaxue"),
Student("20061505","li","88-9-5","06","02","tumu","jianzu")
};
int i;
for(i=0;i<5;i++)
{
stu[i].show();
}
int j;
cout<<"请输入要该第几项"< cin>>j;
stu[j-1].setinfo();
stu[j-1].show();
return 0;
}
--------------------next---------------------
阅读(1250) | 评论(0) | 转发(0) |