Board logo

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

作者: 方浩葦    時間: 2024-7-13 09:09     標題: [作業] 購物系統 (一)

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

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

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

作者: 林少謙    時間: 2024-7-13 15:07

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

作者: 李唯銘    時間: 2024-7-13 15:17

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

作者: 劉奕劭    時間: 2024-7-13 15:27

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string a[7]={"遙控汽車","飛機模型","足球/t","拼圖/t","玩具槍","可愛玩偶","籃球/t"};
  7.     int b[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<<")"<<a[i]<<"\t"<<b[i]<<"元"<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

作者: 洪榮辰    時間: 2024-7-14 11:26

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

作者: 高湘庭    時間: 2024-7-14 17:09

  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. cout<<"<8>"<<"結帳"<<endl;



  12. system("pause");
  13. return 0;
  14. }
複製代碼

作者: 陳妍蓁    時間: 2024-7-19 22:19

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

  11. system("pause");
  12. return 0;
  13. }
複製代碼





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