int client::add_user(item & item_in)
{
char temp[ASIZE];
cout << "\n\nEnter the name of your item: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
get_upper(temp);
item_in.name = temp;
cout << "\n\nEnter in effect one: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
get_upper(temp);
item_in.effect1 = temp;
cout << "\n\nEnter in effect two: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
get_upper(temp);
item_in.effect2 = temp;
cout << "\n\nEnter in effect three: ";
cin.get(temp, 100, '\n');
cin.ignore(100, '\n');
get_upper(temp);
item_in.effect3 = temp;
cout << "\n\nEnter in effect four: ";
cin.get(temp, 100, '\n');
cout << "this";
cin.ignore(100, '\n');
cout << "that";
get_upper(temp);
item_in.effect4 = temp;
...了解我确信这段代码有很多问题,我遇到的问题是前四个块运行得很好,但是当我使用 g++ 编译这段代码并运行它时,“this”显示,然后是分段错误,没有“那个”。有任何想法吗?