[問題] 附程式 請幫我看bug
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cctype>
using namespace std;
int main()
{
cout<<"start";
cin.get();
char ch;
cin.get(ch);
while(ch!='@')
{
if(!isdigit(ch))
{
if(isupper(ch))
cout<<tolower(ch);
else if(islower(ch))
cout<<toupper(ch);
else
cout<<ch;
}
else
cin.get(ch);
}
}
我希望能輸入隨意的字母
輸出"大小寫互換"且"數字無法讀入"的字母,直到按下'@'就會終止
不過這是我出現的結果
start
xc xzcvzxc ZXDCVXZV @DCFVMC;X
8867 88906786908867 12212010099118120122118
結果輸出全變成數字了QQ
請問bug在哪呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.14.246
→
07/09 20:52, , 1F
07/09 20:52, 1F
→
07/09 21:01, , 2F
07/09 21:01, 2F
推
07/09 22:09, , 3F
07/09 22:09, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章