1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| void ModifyPerson(Addressbooks *abs) { string name; cout<<"请输入要修改的人的姓名:"<<endl; cin>>name; int res = isExist(abs, name); if (res != -1) { string new_name; cout<<"修改后姓名"<<endl; cin>>new_name; abs->array[res].name = new_name; cout << "请输入性别:" << endl; cout << "男/女" << endl; string sex = "男"; while (true) { cin >> sex; if (sex == "男" || sex == "女") { abs->array[res].sex = sex; break; } cout<<"输入错误,请重新配置"<<endl; } int new_age; cout<<"修改后年龄"<<endl; cin>>new_age; abs->array[res].age = new_age; cout<<"修改后电话:"<<endl; string new_phone; cin>>new_phone; abs->array[res].phone = new_phone; cout<<"修改后地址:"<<endl; string new_add; cin>>new_add; abs->array[res].add = new_add;
cout<<"修改成功"<<endl;
} else { cout<<"查无此人!!!"<<endl; } }
|