返回列表 發帖

自我介紹

本帖最後由 tonyh 於 2016-3-5 11:32 編輯

試宣告五個變數來裝你的個人資料, 分別為2個字串(string)變數, 1個整數(int)變數, 2個浮點數(float)變數, 完成如下的執行畫面:

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="黃國穎",school="愛國國小";
  7.     int age=9;
  8.     float h=1.38,w=27.5;
  9.     cout<<"我的大名: "<<name<<endl;
  10.     cout<<"就讀: "<<school<<endl;
  11.     cout<<"今年: "<<age<<" 歲"<<endl;
  12.     cout<<"身高: "<<h<<" 公分"<<endl;
  13.     cout<<"體重: "<<w<<" 公斤"<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="陸長辰",school="英明國中";
  7.     int age=13;
  8.     float h=166,w=30;
  9.     cout<<"我的大名:"<<name<<endl;
  10.     cout<<"就讀:"<<school<<endl;
  11.     cout<<"今年:"<<age<<" 歲"<<endl;
  12.     cout<<"身高:"<<h<<" 公分"<<endl;
  13.     cout<<"體重:"<<w<<" 公斤"<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>      
  2. #include<cstdlib>      
  3. using namespace std;
  4. int main()     
  5. {
  6.     string name="方宥鈞",school="岡山國小";
  7.     int age=9;
  8.     float h=138.6,w=27.5;
  9.     cout<<"我的大名: "<<name<<endl;
  10.     cout<<"就讀:"<<school<<endl;
  11.     cout<<"今年:"<<age<<"歲"<<endl;
  12.     cout<<"身高: "<<h<<"cm"<<endl;
  13.     cout<<"體重:"<<w<<"kg"<<endl;
  14.     system("pause");
  15.     return 0;   
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main ()
  5. {
  6.    string  name="陳泓瑜",school="文山國小";
  7.    int age=11;
  8.    float high=151.4,weight=39.2;
  9.    
  10.    cout<<"姓名: "<<name<<endl;
  11.    cout<<"就讀: "<<school<<endl;
  12.    cout<<"年齡: "<<age<<" 歲"<<endl;
  13.    cout<<"身高: "<<high<<" CM"<<endl;
  14.    cout<<"體重: "<<weight<<" KG"<<endl;
  15.    
  16. system("pause");
  17. return 0;

  18. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="高允懋";
  7.     string school="龍華國中";
  8.     int age=12;
  9.     float high=153.5;
  10.     float weight=36.5;
  11.     cout<<"我的大名: "<<name<<endl;
  12.     cout<<"就讀: "<<school<<endl;
  13.     cout<<"今年: "<<age<<" 歲"<<endl;
  14.     cout<<"身高: "<<high<<" 公分"<<endl;
  15.     cout<<"體重: "<<weight<<" 公斤"<<endl;
  16.     system("pause");
  17.     return 0  ;
  18.     }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="黃茂勛",school="英明國中";
  7.     int age=12;
  8.     float h=168.5,w=53.2;
  9.     cout<<"我的大名: "<<name<<endl;
  10.     cout<<"就讀: "<<school<<endl;
  11.     cout<<"今年: "<<age<<" 歲"<<endl;
  12.     cout<<"身高: "<<h<<" 公分"<<endl;
  13.     cout<<"體重: "<<w<<" 公斤"<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main;
  5. {
  6.     string name ="任立宇"
  7.     strung school ="勝利國小"
  8.     int age = 9;
  9.     float h=154,w=47
  10.     cout<<"我的名"<<"<<name<<endl;
  11.     cout<<"讀"<<"<<school<<endl;
  12.     cout<<"今年"<<"<<<<endl;
  13.     cout<<"身高"<<"<<公分<<endl;
  14.     cout<<"體重"<<"<<公斤<<endl;
  15.     syatam()
  16.     return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.   string name="張孟軒",school="明華國中";
  7.   int age=14;
  8.   float h=1.80,w=54;
  9.   cout<<"我的大名"<<name<<endl;
  10.   cout<<"就讀"<<school<<endl;
  11.   cout<<"今年"<<age<<" 歲"<<endl;
  12.   cout<<"身高"<<h<<"公分"<<endl;
  13.   cout<<"體重"<<w<<"公斤"<<endl;
  14.   system("pause");
  15.   return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="康湍榆",school="四維國小";
  7.     int age=10;
  8.     float h=153.8,w=45.22;
  9.     cout<<"大名: "<<name<<endl;
  10.     cout<<"就讀: "<<school<<endl;
  11.     cout<<"年紀: "<<age<<" 歲"<<endl;
  12.     cout<<"身高: "<<h<<" 公分"<<endl;
  13.     cout<<"大名: "<<w<<" 公斤"<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

返回列表