返回列表 發帖

購物系統 (一)

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

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

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5.     cout<<"☆★☆《影武的網路商城》☆★☆"<<endl;
  6.     cout<<endl;
  7.     cout<<"〔商品價目表〕"<<endl;
  8.     string list[7]={"Grand Theft Auto 5","H1Z1","Rust","Minecraft","Minecraft stroy:mode","CS:GO","garry's mod"};
  9.     int money[7]={1600,876,328,810,562,528,328};
  10.     for ( int i=0 ; i<7 ; i++)
  11.      {
  12.         cout<<"("<<i+1<<")"<<list[i]<<""<<"\t"<<money[i]<<"元"<<endl;
  13.      }
  14.      cout<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

TOP

本帖最後由 吳承勳 於 2016-4-18 17:09 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int price[7]={790, 870, 110, 230, 950, 770, 375};
  7.     string name[7]={"遙控汽車","飛機模型","足球","拼圖","玩具槍","可愛玩偶","籃球"};
  8.     cout << "[商品價目表]" << endl;      
  9.     for(int i = 0; i <= 6; i++)                                                                              
  10.     {
  11.             cout << "(" << i+1 << ")" << name[i] << "    " << "\t" << price[i] << "元" << endl;
  12.     }
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

本帖最後由 蔡季樺 於 2016-4-20 13:26 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string name[7]={"火焰藥水","放屁藥水","作夢藥水","打呵欠藥水","超人藥水","打老師藥水","萬能藥水"};
  7.     int money[7]={200,50,100,10,2000,1100,1000000000};            
  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.     cout<<endl;
  15.     system("pause");
  16.     return 0;   
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5.     cout<<"☆★☆《影武的網路速食店》☆★☆"<<endl;
  6.     cout<<endl;
  7.     cout<<"〔商品價目表〕"<<endl;
  8.     string list[7]={"薯條","漢堡","可樂","雪碧","奶昔","紅茶","披薩"};
  9.     int money[7]={50,80,45,45,55,45,299};
  10.     for ( int i=0 ; i<7 ; i++)
  11.      {
  12.         cout<<"("<<i+1<<")"<<list[i]<<""<<"\t"<<money[i]<<"元"<<endl;
  13.      }
  14.      cout<<endl;
  15.      system("pause");
  16.      return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int price[7]={100000, 7470, 7410, 254, 8750, 87440, 9999999995};
  7.     string name[7]={"打罵因酒","拉屎餅乾","死掉藥水","屁","川普的屁","歐媽媽","串鋪川普"};
  8.     cout << "怪怪商店商品價目表" << endl;      
  9.     for(int b = 0; b <= 6; b++)
  10.      {
  11.             cout << "(" << b+1 << ")" << name[b] << "    " << "\t" << price[b] << "元" << endl;
  12.      }
  13.      system("pause");
  14.      return 0;
  15. }
  16.            
複製代碼

TOP

返回列表