Trending News
Promoted
c++ 如何使用while迴圈
我這是程式碼的一部分
他都只能執行一次
如何就是能重複執行(可以一直按1,按2)
我們看老師是用while迴圈
如何使用呢?!
還是有其他方法呢?!
if(ch=='1')
{
puts("加密後:");
puts(encode (str));
}
else if(ch=='2')
{
puts("解密後:");
puts(decode (str));
}
else if(ch=='3')
puts("離開");
system("pause");
}
1 Answer
Rating
- 1 decade agoFavorite Answer
while(ch!='3')
{
if(ch=='1')
{
puts("加密後:");
puts(encode (str));
}
else if(ch=='2')
{
puts("解密後:");
puts(decode (str));
}
else if(ch=='3')
{
puts("離開");
}
}
system("pause");
2009-06-10 20:54:19 補充:
while(ch!='3')
代表只要輸入不為3時
迴圈就會持續
直到ch=='3'時才跳出
Source(s): 自己
Still have questions? Get your answers by asking now.