Board logo

標題: 購物系統 (一) [打印本頁]

作者: tonyh    時間: 2022-12-31 14:48     標題: 購物系統 (一)

運用陣列技巧,設計一購物系統的商品價目表,商店名稱商品價格 請同學們發揮創意自由發揮。

提示:宣告兩個一維陣列,分別裝商品名稱與商品價格。

  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. }
複製代碼

作者: 羅紹齊    時間: 2022-12-31 15:06

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

作者: 林雋喆    時間: 2022-12-31 15:06

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"AR15      ","M4        ","scored M4   ","98K        ","AMP       ","AK47      ","RPG    "};
  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. }
複製代碼

作者: 吳俊頡    時間: 2022-12-31 15:08

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     string n[]={"手榴彈","狙擊槍","火箭筒","AK47  ","散彈槍"};
  6.     int price[]={450,550,325,200,660,150};
  7.     cout<<"武器店"<<endl<<endl;
  8.     cout<<"[商品價目表]"<<endl;
  9.     for(int i=0; i<7; i++)
  10.          cout<<"("<<i+1<<")"<<n[i]<<"\t"<<price[i]<<"元"<<endl;   
  11.     system("pause");
  12.     return 0;
  13. }
複製代碼

作者: 翁川祐    時間: 2022-12-31 15:08

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

作者: 陳牧謙    時間: 2022-12-31 15:08

  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. }
複製代碼

作者: 葉佳和    時間: 2022-12-31 15:09

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"沙德威斯坦","蟑螂屍體","萊柏屬塾大狙","加八十攝影","阿帕茶","破甲箭","地下水"};
  7.     int price[]={10000,10,500,540,0,9999,50};
  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. }
複製代碼

作者: 宜儒    時間: 2022-12-31 15:09

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.         string name[]={"怪味豆       ","巧克力青蛙     ","故障的隱形斗篷   ","變身藥水      ","反彈魔杖      "};
  6.         int price[]={30,50,350,500,650};
  7.         cout<<"==========弗雷與喬治的整人玩具店=========="<<endl<<endl;
  8.         cout<<"[商品價目表]"<<endl;
  9.         for(int i=0;i<5;i++)
  10.                 cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  11.         system("pause");
  12.         return 0;
  13. }
複製代碼

作者: 陳宥霖    時間: 2022-12-31 15:10

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"遙控車","飛機模型","籃球    ","101拼圖    ","遊戲機  ","可愛玩偶","棒球    "};
  7.     int price[]={90,70,30,60,80,50,20};
  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. }
複製代碼

作者: 盧禹丞    時間: 2022-12-31 15:11

  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<<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. }
複製代碼

作者: 徐啟祐    時間: 2022-12-31 15:11

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

作者: 羅暐傑    時間: 2023-1-6 21:50

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     string name[]={"手機   ","電腦   ","智慧型手錶","藍牙耳機","耳罩式耳機","折疊手機","電腦顯示器"};
  6.     int price[]={450,3000,325,200,660,1200,380};
  7.     cout<<"電子產品店"<<endl<<endl;
  8.     cout<<"商品價目表:"<<endl;
  9.    
  10.     for(int i=0; i<7; i++) {
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"$USD"<<endl;
  12.     }
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

作者: 楊芊琦    時間: 2023-1-13 21:41

  1. #include<cstdlib>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.         string protuct[] = { "傳說對決","英雄聯盟","寶可夢集結","寶寶巴士","阿嬤跑酷" };
  7.         int price[] = { 2000,1000,500,500,1000 };
  8.         cout << "--------------遊戲儲值代儲--------------" << endl;
  9.         cout << "商品價目表:" << endl;
  10.         for (int i = 0;i <= 4;i++)
  11.         {
  12.                 cout << i + 1 << "號商品 ";
  13.                 cout << protuct[i] << "                " << price[i] << "元" << endl;;
  14.         }
  15.         system("pause");
  16.         return 0;
  17. }
複製代碼

作者: 黃品禎    時間: 2023-5-17 18:20

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

  11.     for(int i=0;i<7;i++ )
  12.     {
  13.           cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  14.          
  15.     }
  16. system("pause");
  17.     return 0;
  18. }  
複製代碼

作者: 朱奕祈    時間: 2024-1-29 17:08

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {       
  6.         string name[6]={"外星槍","手槍    ","野牛衝鋒槍","火焰噴射器","湯瑪遜衝鋒槍","大砲      "};
  7.         int money[6]={450,120,300,540,430,700};
  8.         cout<<"☆★☆智能槍具店☆★☆"<<endl;
  9.         cout<<"[商品價目表]"<<endl;
  10.         for(int i=0;i<6;i++)
  11.         {
  12.                 cout<<"("<<i+1<<")"<<name[i]<<"\t"<<money[i]<<"元"<<endl;
  13.         }
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2