為什么我輸入Y或者N的時(shí)候會(huì)是這樣?現(xiàn)在正在下雨現(xiàn)在正在下雨嗎(Y/N)#includeusing namespace std;int main(){char a;int b;while (a=1) { cout << "現(xiàn)在正在下雨嗎" << '\n' << "(Y/N)" << endl;
cin >> a;
switch (a) {
case 'Y':
cout << "現(xiàn)在正在下雨";
a = 2;
break;
case'N':
cout << "現(xiàn)在沒(méi)有下雨";
a = 2;
break;
default:
a = 1;
}
}
return 0;}
C++編程問(wèn)題請(qǐng)大神賜教
千萬(wàn)里不及你
2018-07-04 17:15:04