代码如下#include<iostream>
using namespace std;
int main()
{
char *pstr1("NO.1 choice");
char *pstr2("NO.2 choice");
char *pstr3("NO.3 choice");
char *pstr("your choice is:");
int dice(0);
cout<<"pick a number!"<<"a number between 1 and 3:"<<endl;
cin>>dice;
cout<<endl;
switch(dice)
{
case1:cout<<pstr<<pstr1;
break;
case2:cout<<pstr<<pstr2;
break;
case3:cout<<pstr<<pstr2;
break;
default:cout<<"sorry,you haven't made a true choice";
}
cout<<endl;
return 0;
using namespace std;
int main()
{
char *pstr1("NO.1 choice");
char *pstr2("NO.2 choice");
char *pstr3("NO.3 choice");
char *pstr("your choice is:");
int dice(0);
cout<<"pick a number!"<<"a number between 1 and 3:"<<endl;
cin>>dice;
cout<<endl;
switch(dice)
{
case1:cout<<pstr<<pstr1;
break;
case2:cout<<pstr<<pstr2;
break;
case3:cout<<pstr<<pstr2;
break;
default:cout<<"sorry,you haven't made a true choice";
}
cout<<endl;
return 0;
}
运行后 我不管输入什么那个黑框子直接退了 求解这是为什么啊?