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兩種寫法。

留言

這個網誌中的熱門文章

a003: 兩光法師占卜術

程式設計0923作業