不懂什麼是
以一个while 回圈来读取所有的测试资料
不懂什麼是
以一个while 回圈来读取所有的测试资料
C 解題範例
#include<stdio.h>
int main() {
char s[9999];
while( scanf("%s",s)!=EOF ) {
printf("hello, %s\n",s);
}
return 0;
}
C++ 解題範例
#include <iostream>
using namespace std;
int main() {
string s;
while(cin >> s){
cout << "hello, "<< s << endl;
}
return 0;
}
用一個while可以重覆讀取input