返回列表 發帖

購物系統 (一)

本帖最後由 tonyh 於 2014-1-25 18:04 編輯

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


本帖隱藏的內容需要回復才可以瀏覽
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main ()
  5. {
  6.   cout<<"~~~超酷球店~~~"<<endl<<endl;
  7.   cout<<"(商品價目表)"<<endl;  
  8.   string name[5]={"乒乓球",
  9.                   "棒球  ",
  10.                   "足球  ",
  11.                   "躲避球",
  12.                   "籃球  "};
  13.   int money[5]={50,100,125,200,600};
  14.   for(int i=0; i<=4; i++)
  15.   {
  16.       cout<<"("<<i+1<<")"<<name[i]<<"\t"<<money[i]<<"元"<<endl;
  17.   }
  18.   system ("pause");   
  19.   return 0;
  20.    
  21. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<iostream>
  3. #include<cstdlib>
  4. using namespace std;
  5. int main()
  6. {
  7.    string name [6]={"青茶","水果茶","檸檬水","奶茶","水","綠茶"};
  8.    string price [6]={"15","20","15","25","10","20"};
  9.    cout<<"多喝水飲料店"<<endl;
  10.    cout<<"[飲料價目表]"<<endl;              
  11.    for(int i=0; i<=5; i++)
  12.    {
  13.            cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;              
  14.    }
  15.    system ("pause");
  16.    return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<iostream>
  3. #include<cstdlib>
  4. using namespace std;
  5. int main()
  6. {
  7.    string name [6]={"冬瓜茶","蘋果冰沙","檸檬愛玉","珍珠奶茶","阿華田","多多綠茶"};
  8.    string price [6]={"20","30","25","25","25","25"};
  9.    cout<<"=====超級飲料店====="<<endl;
  10.    cout<<"[飲料價目表]"<<endl;              
  11.    for(int i=0; i<=5; i++)
  12.    {
  13.            cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;              
  14.    }
  15.    system ("pause");
  16.    return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.   cout<<"***Legend's Sports Store***"<<endl;
  7.   cout<<"The Price LIST"<<endl;
  8.   string name[7]={"Rose4               ",
  9.                  "NIKE Ambassader",
  10.                  "JORDAN FLIGHT",
  11.                  "ADIfast       ",
  12.                  "adizero crazy light",
  13.                  "NIKE hyperdunk 2013",
  14.                  "ADIZERO CRAZY QUICK"};
  15.   int price[7]={4500,
  16.                 3950,
  17.                 2400,
  18.                 2780,
  19.                 2950,
  20.                 2495,
  21.                 2154};
  22.     for(int i=0;i<=6;i++)
  23.     {
  24.     cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;        
  25.     }                          
  26. system("pause");
  27. return 0;      
  28. }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     cout<<"***  special植物專賣店  ***"<<endl<<endl;
  7.     string name[7]={"黃金玫瑰","食人花",
  8.                     "幽靈草","瘋樹  ",
  9.                     "魔鬼藤蔓","含兇草",
  10.                     "搖頭樹"};
  11.     int price[7]={7099,1598,2960,1800,4050,3999,6540};
  12.     for(int i=0; i<=6; i++)
  13.     {
  14.       cout<<"<"<<i+1<<">"<<name[i]<<"\t"<<price[i]<<"元"<<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]={"遙控飛機","水槍  ","玩偶  ","足球  ","拼圖  ","籃球  ","玩具車"};
  7.     int price[7]={50000,6500000,70000,655000,999999,300000,750000};
  8.     cout<<"***貴死人玩具店***"<<endl<<endl;
  9.     cout<<"[商品價目表]"<<endl;
  10.     for(int i=0;i<=6;i++)
  11.     {
  12.         cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[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.   cout<<"∮∮∮愛心甜點店店∮∮∮"<<endl;
  7.   cout<<"~商品價目表~"<<endl;  
  8.   string n[5]={"卡布奇諾     ","濃郁黑咖啡   ","焦糖瑪奇朵   ","黑森林蛋糕   ","原味起司蛋糕 "};
  9.   int p[5]={160,210,125,95,65};
  10.   for(int i=0; i<=4; i++)
  11.   {
  12.           cout<<"("<<i+1<<")"<<"  "<<n[i]<<"   "<<p[i]<<endl;
  13.   }
  14.   system ("pause");   
  15.   return 0;
  16.    
  17. }
複製代碼

TOP

返回列表