注册 登录
编程论坛 新人交流区

c++结构体问题

dive137 发布于 2007-10-17 10:47, 369 次点击
#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的时候进入死循环。
0 回复
1