2020年2月7日 星期五
利用輸入ctrl-z按enter來跳出while回圈
//利用輸入ctrl-z按enter來跳出while回圈
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int lower_case_count=0;//counter
char ch;
while(cin >> ch)
{
if(ch >='a' && ch <= 'z')
lower_case_count++;
}
cout << "lower case count:" << lower_case_count << endl;
system("PAUSE");
return 0;
}
訂閱:
張貼留言 (Atom)
algorithm
#include <iostream> #include <string.h> using namespace std; int main(int argc, char** argv) { for(int j=2;j<=100;j++)//j...

沒有留言:
張貼留言