Board logo

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

作者: tonyh    時間: 2020-12-5 19:52     標題: 購物系統 (一)

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

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

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

作者: 余柏緯    時間: 2020-12-5 19:59

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

作者: 李柏穎    時間: 2020-12-5 20:00

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[7]={"遙控汽車","飛機模型","足球    ","拼圖    ","玩具槍  ","可愛玩偶","籃球    "};
  7.     int price[7]={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. }
複製代碼

作者: 王宇崴    時間: 2020-12-5 20:01

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"汽車模型","飛機模型","足球模型","拼圖模型","槍槍模型  ","可愛玩偶","籃球    "};
  7.     int price[]={444444,5555555,3333333,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. }
複製代碼

作者: 朱奕祐    時間: 2020-12-5 20:01

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

作者: 黃子倢    時間: 2020-12-5 20:04

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string n[5]={"玩具車","熊玩偶","羽毛球","乒乓球","玩具槍"};
  7.     int p[5]={450,300,30,10,600};
  8.     cout<<"☆智能玩具店☆"<<endl<<endl;
  9.     cout<<"商品價目表"<<endl<<endl;
  10.     for(int i=0; i<5; i++)
  11.     {
  12.            cout<<"("<<i+1<<")"<<n[i]<<"\t"<<p[i]<<"元"<<endl;   
  13.     }   
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

作者: 俞成章    時間: 2020-12-5 20:04

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"汽車","飛機","足球原子彈    ","笑氣球    ","狙擊槍  ","可愛玩偶炸彈","籃球手榴彈    "};
  7.     int price[]={860,750,325,890,660,140,580};
  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. }
複製代碼

作者: 林鼎傑    時間: 2020-12-5 20:07

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"黃色飛機 ","金正恩模型","笑氣    ","智障遊戲","手槍   ","充氣玩偶","籃鳥    ","核彈  ","雄商飛彈"};
  7.     int price[]={1233,666,325,999,2150,2999,799,95000000,49999999};
  8.     cout<<"☆★☆畸形軍火庫☆★☆"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<9; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

作者: 王首二    時間: 2020-12-5 20:12

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"手榴彈","F36 ","核彈  ","RPG ","廢物    "};
  7.     int price[]={450,550,325,200,660};
  8.     cout<<"☆★☆智能軍火店☆★☆"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0; i<5; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

作者: 許洧熏    時間: 2020-12-5 20:15

本帖最後由 許洧熏 於 2020-12-5 20:23 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"飛機","特斯拉","法拉利    ","遊覽車    ","公車  ","嘿嘿車","電動玩具車    "};
  7.     int price[]={850,250,925,660,150,380};
  8.     cout<<"☆★☆玩具店☆★☆"<<endl<<endl;
  9.     cout<<"[商品價格表]"<<endl;
  10.     for(int i=0; i<6; i++)
  11.          cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

作者: 呂尚霖    時間: 2020-12-5 20:18

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[]={"火箭炮彈","防護盾槍","核彈    ","手槍    ","特斯拉  ","警察手銬","步槍    "};
  7.     int price[]={5000,59487,999999,1,660000,15,8787};
  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.          
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

作者: 王秉鈞    時間: 2020-12-5 20:25

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[6]={"雪莉(玩偶)","黑雞 鐵鏟 氫氣氣球","炸彈    ","鉛筆模型      ","明太子(炸彈)      ","史派克      "};
  7.     int price[6]={0,658,95110,45454,78945,9214};
  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. }
複製代碼





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