在学通讯录系统
void addperson(address_book* abs)
{
if (abs->a_size == MAX)
{
cout << "the_address_book_is_full_and_cannot_be_added" << endl;
return;
}
else
{
string name;
cout << "add_name" << endl;
cin >> name;
abs->arrp[abs->a_size].c_name = name;
int sex = 0;
cout << "add_sex" << endl;
cout << "1__man" << endl;
cout << "2__woman" << endl;
while (true)
{
cin >> sex;
if (sex == 1 || sex == 2)
{
abs->arrp[abs->a_size].c_sex = sex;
break;
}
else
{
cout << "input_error_please_input_again" << endl;
}
}
int age = 0;
cout << "please_add_age" << endl;
cin >> age;
abs->arrp[abs->a_size].c_addr = age;
string phone;
cout << "please_add_phone" << endl;
cin >> phone;
abs->arrp[abs->a_size].c_phone = phone;
string address;
cout << "please_add_address" << endl;
cin >> address;
abs->arrp[abs->a_size].c_addr = address;
cout << "successfully_added" << endl;
abs->a_size++;//update_the_number_of_person
system("pause");
system("cls");//clear_screen
}
};
部分代码是这样的,
为什么输入年龄后显示 age: -858993460 这玩意。
求解