返回列表 發帖

購物系統 (一)

本帖最後由 王瑞喻 於 2019-10-12 09:28 編輯

運用陣列技巧, 設計一購物系統的商品價目表, 商店名稱與商品價格請同學們發揮創意自由發揮.
提示: 宣告兩個一維陣列, 分別裝商品名稱與商品價格.

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控汽車","飛機模型","足球    ","拼圖    ","玩具槍  ","可愛玩偶","籃球    "};
  7.     int price[]={450,550,325,200,660,150,380};
  8.     cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控器車","飛機模型","足球","拼圖","玩具槍","可愛玩偶","籃球"};
  7.     int price[]={450,550,325,200,660,150,380};
  8.     cout<<"***智能玩具店***"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

本帖最後由 王建葦 於 2019-10-18 19:08 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"Millet           "
  7.                   ,"SONY             "
  8.                   ,"Samsung          "
  9.                   ,"OPPO             "
  10.                   ,"APPLE            "
  11.                   ,"Koreafish        "
  12.                   ,"ASUS             "
  13.                   ,"VegetablesEnglish"};
  14.     int m[]={9000,7000,7000,8000,50000,0,9000,0};
  15.     cout<<"=====不知道賣什麼的專賣店====="<<endl;
  16.     cout<<"[商品價目表]"<<endl;
  17.     for(int i=0;i<=7;i++)
  18.     {
  19.         cout<<"("<<i+1<<")"<<name[i]<<"\t"<<m[i]<<"元"<<endl;     
  20.     }
  21.     cout<<"總金額: "<<sum<<"元"<<endl;
  22.     system("pause");
  23.     return 0;
  24. }
  25.   
複製代碼
Jian-wei Wang

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"阿法狗","深藍   ","絕藝    ","里拉    ","ZenGO  ","LGS   ","手談    "};
  7.     int price[]={8700,3800,7800,2000,6600,1500,5900};
  8.     cout<<"軟體店"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控汽車","飛機模型","足球    ","拼圖    ","玩具槍  ","可愛玩偶","籃球    "};
  7.     int price[]={450,550,325,200,660,150,380};
  8.     cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[5]={"法拉利","藍寶傑尼","特斯拉","賓士","BMW"};
  7.     int a[5]={400,350,250,150,125};
  8.     cout<<"***跑車專賣***"<<endl<<endl;
  9.     cout<<"[價目表]"<<endl;
  10.     for(int i=0; i<4; i++)
  11.     {
  12.         cout<<"("<<i+1<<")"<<name[i]<<"\t"<<a[i]<<"萬元"<<endl;        
  13.     }
  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.     int price[]={450,550,325,200,660,150,380};
  8.     cout<<"***智能玩具店***"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控器車","飛機模型","足球","拼圖","玩具槍","可愛玩偶","籃球"};
  7.     int price[]={450,550,325,200,660,150,380};
  8.     cout<<"***智能玩具店***"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控汽車","飛機模型","足球    ","拼圖    ","玩具槍  ","Tony老師","籃球    "};
  7.     int price[]={450,550,325,200,660,878,380};
  8.     cout<<"無智能玩具店"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"◎◎◎玩具店◎◎◎"<<endl<<endl<<"[商品價目表]"<<endl;
  7.     string p[7][2]={{"遙控汽車","450"},{"飛機模型","550"},{"足球","325"},{"拼圖","200"},{"玩具槍","660"},{"可愛玩偶","150"},{"籃球","380"}};
  8.     for(int i=0;i<7;i++)
  9.     {
  10.         cout<<"〈"<<i+1<<"〉";
  11.         for(int a=0;a<1;a++)
  12.             cout<<p[i][a]<<"\t";
  13.         for(int a=1;a<2;a++)
  14.             cout<<p[i][a]<<"元"<<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.         int price[]={450,550,325,200,660,150,380};
  8.         cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
  9.         cout<<"[商品價目表]"<<endl;
  10.         for(int i=0; i<7; i++)
  11.                 cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.         system("pause");
  13.         return 0;
  14. }
複製代碼

TOP

本帖最後由 郭哲維 於 2019-10-1 19:45 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控器車","飛機模型","足球    ","拼圖    ","玩具槍  ","可愛玩偶","籃球    "};
  7.     int price[]={450,550,325,200,660,150,380};
  8.     cout<<"☆★☆開心玩具店☆★☆"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<7; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");   
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string n[7]={"車","飛機","足球","拼圖","槍","玩偶","籃球"};
  7.     int m[7]={100,150,200,250,300,350,400};
  8.     cout<<"@@@@玩具店@@@@"<<endl<<endl<<"$$$價目表$$$"<<endl;
  9.     for(int i=0;i<7;i++)
  10.     {
  11.          cout<<"("<<i+1<<")"<<n[i]<<"\t\t"<<m[i]<<"元"<<endl;
  12.     }
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

返回列表