a001. 哈囉
#include <stdio.h>
int main(void)
{
char input[1000];
while(gets(input)!=NULL)
{
printf("hello, %s\n",input);
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
string s;
while(cin >> s){
cout << "hello, "<< s << endl;
}
return 0;
}
兩種方法,主要差別在於printf及cout兩種寫法。
留言
張貼留言