返回列表 發帖

自我介紹

試宣告五個變數來裝你的個人資料, 分別為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=138.6, 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. }
複製代碼
Su Wa

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="張微?",school="龍華國中";
  7.     int age=15;
  8.     float h=167.3,w=48.7;
  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# 王瑞喻

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string na="楊易",sc="民族國小";
  7.     int a=15;
  8.     float h=163.5,w=55;
  9.     cout<<"我的大名: "<<na<<endl;
  10.    cout<<"就讀: "<<sc<<endl;
  11.    cout<<"今年: "<<a<<"歲"<<endl;
  12.   cout<<"身高: "<<h<<"cm"<<endl;
  13.   cout<<"體重: "<<w<<"kg"<<endl;
  14.     system("pause");
  15.     return 0;
  16.   
  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 x=167.4 ,y=49.4;
  9.     cout<<"我的大名: "<<name<<endl;
  10.     cout<<"就讀: "<<school<<endl;
  11.     cout<<"今年: "<<age<<"歲"<<endl;
  12.     cout<<"身高"<<x<<"cm"<<endl;
  13.     cout<<"體重"<<y<<"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=15;
  8.     float h=169.2,w=52.4;
  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=15;
  8.     float h=162,w=45;
  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

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    string name="蔡昀妮",school="明華國中";
    int age=15;
    float h=155.5,w=45.0;
    cout<<"我的大名:"<<name<<endl;
    cout<<"就讀:"<<school<<endl;
    cout<<"今年:"<<age<<"歲"<<endl;
    cout<<"身高:"<<h<<"公分"<<endl;
    cout<<"體重:"<<w<<"公斤"<<endl;
    system("pause");
    return 0;
}

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name="李柏穎", school="左營國中";
  7.     int age=158;
  8.     float h=168.2,w=55.8;
  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

返回列表