返回列表 發帖

自我介紹

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

  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=170.0,w=52.0;
  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 <<  "公分" << 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.     float h=168.8,w=48.5;
  7.     string n="Louis.L",s="I-Show International School",c="9R";
  8.    
  9.     cout<<"\nname:\t"<<n<<"\nschool:\t"<<s<<"\nclass:\t"<<c<<"\nheight:\t"<<h<<"\nweight\t"<<w<<"\n";
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

TOP

  1. [code]#include<cstdlib>
  2. using namespace std;
  3. int main()
  4. {
  5.         string name="黃郁甯",school=信義國小       
  6.         int age=14;
  7.         float h=160.1,w=40.5;
  8.         coat<<"我的大名"<<name<<endl
  9.         coat<<"就讀"<<school<<endl;
  10.         coat<<"身高"<<h<<endl;
  11.         coat<<"體重"<<endl;
  12.         return0;
  13. }
複製代碼
[/code]回復 7# 黃郁甯

TOP

本帖最後由 黃郁甯 於 2023-5-30 19:04 編輯
  1. #include<cstdlib>
  2. using namespace std;
  3. int main()
  4. {
  5.         string name="黃郁甯",school=信義國小       
  6.         int age=14;
  7.         float h=160.1,w=40.5;
  8.         coat<<"我的大名"<<name<<endl
  9.         coat<<"就讀"<<school<<endl;
  10.         coat<<"身高"<<h<<endl;
  11.         coat<<"體重"<<endl;
  12.         return0;
  13. }
複製代碼

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 =168.5, w =62.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. }
複製代碼

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=160.1,w=50.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. }
複製代碼

TOP

  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 = 160.5 , w = 40.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. }
複製代碼

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=158.9 ,w=54.6;
  9.   cout<<"我的名字: "<<name<<endl;
  10.   cout<<"就讀: "<<school<<endl;
  11.   cout<<"今年: "<<age<<"歲"<<endl;
  12.   cout<<"身高: "<<h<<"身高"<<endl;
  13.   cout<<"體重: "<<w<<"公斤"<<endl;
  14.    
  15.   system("pause");
  16.   return 0 ;
  17.   
  18.   
  19. }
複製代碼

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=173.1, w=68.1;
  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

返回列表