tgirc早修book
題目
#include <iostream> using namespace std; int main(){ cout<<"hello, world"; return 0; }
單純的輸出而已,有錯的可能是輸出的格式錯誤。 可以直接複製範例測資,就能確保格式正確了。
#include <iostream> using namespace std; int main(){ string s; cin>>s; cout<<"hello, "<<s<<"\n"; return 0; }
相較於上題多了個輸入,透過 string 宣告一個字串 s,再進行輸入即可。 輸出時先輸出題目要求的 hello, ,再輸出裝載輸入訊息的變數 s
hello,
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up