c++结构体问题
#include <iostream>using namespace std;
struct team
{
char name[20];
double money;
};
int main()
{
showMenu();
team *ps=new team[10];
char ch;
cin.get(ch);
while (ch!='e')
{
switch(ch)
{
case 'a':
cout<<"Please enter name: ";
cin.get(ps->name,20);
cout<<"Please enter money: ";
cin>>ps->money;
// initialTeam(ps);
break;
}
showMenu();
cin.get(ch);
}
delete ps;
cout<<"bye...!";
return 0;
}
为什么cin.get(ps->name,20); cin>>ps->money;不干活
还有程序有输入a的时候进入死循环。