返回列表 發帖

抽籤程式

本帖最後由 tonyh 於 2015-5-30 10:40 編輯

發揮創意想想看, 抽籤程式在日生活中甚麼時候可以派上用場呢?





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

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     system("cls");
  8.     string name[7]={"吃下姬路瑞希的殺人料理","被島田美波以暴力虐殺","被霧島翔子路過電死","被悶聲色狼威脅自殺","被臭老太婆長玩死","被?本雄二精神虐待致死","被工藤愛子在飯裡偷偷下藥"};
  9.     srand(time(NULL));
  10.     int ball;
  11.     cout<<"來抽笨蛋吉井的死法..."<<endl;
  12.     cout<<"久:等等等等一下!為什麼我要死!?"<<endl;
  13.     cout<<"二:因為你欠死"<<endl;
  14.     system("pause");
  15.     system("cls");
  16.     for(int i=1;i<=80;i++)
  17.     {
  18.          ball=rand()%7;
  19.          if(i%2==0)
  20.              cout<<"▏▎▍▌▋▊▉█... 抽死法中 ... █▉▊▋▌▍▎▏"<<endl;
  21.          else
  22.              cout<<"█▉▊▋▌▍▎▏... 抽死 法中 ... ▏▎▍▌▋▊▉█"<<endl;
  23.          cout<<name[ball];
  24.          system("cls");
  25.     }
  26.     cout<<"明久將要以"<<name[ball]<<"方式"<<endl;
  27.     cout<<"明:等等等等一下我還不想啊啊啊啊啊啊!"<<endl
  28.         <<"雄:你沒有選擇的餘地"<<endl
  29.         <<"明:我未來的美好人生呢?"<<endl
  30.         <<"色狼:......(冷笑)"<<endl
  31.         <<"工1:否決 ?"<<endl;
  32.     system("pause");
  33.     goto re;
  34.     return 0;   
  35. }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int a;      
  8.     system("cls");
  9.     string name[5]={"MAD","nightcore","動漫OP","VK克","蘇打綠"};
  10.     int ball;
  11.     srand(time(NULL));
  12.     cout<<"要聽哪首歌"<<endl;     
  13.     system("pause");
  14.     system("cls");
  15.     for(int i=0;i<=100;i++)
  16.     {
  17.             ball=rand()%5;
  18.             if(i%2==0)
  19.               cout<<"dsa抽取中asd"<<endl;
  20.             else
  21.               cout<<"asd抽取中dsa"<<endl;
  22.               cout<<name[ball]<<endl;
  23.               system("cls");
  24.     }  
  25.     cout<<"聽"<<name[ball]<<endl;
  26.    system("pause");
  27.    goto re;
  28.    return 0;
  29. }
複製代碼
http://fs-old.mis.kuas.edu.tw/~s1102137106/music/

TOP

本帖最後由 tonyh 於 2015-5-30 11:06 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int sum2=0, lose=0, same=0;
  7.     allre:
  8.     system("cls");
  9.     int thing[5]={100,500,1000,5000,10000};
  10.     int dollers1;
  11.     int dollers2;
  12.     srand(time(NULL));
  13.     cout<<"***抽獎大會***"<<endl;
  14.     cout<<"第1次抽獎你抽中什麼呢?"<<endl<<endl;
  15.     system("pause");
  16.     system("cls");
  17.     for(int i=0;i<=150;i++)
  18.     {
  19.         dollers1=rand()%5;
  20.         if(i%2==0)
  21.             cout<<"***抽獎中...***"<<endl;
  22.         else
  23.             cout<<"*******抽獎中...*******"<<endl;   
  24.         cout<<thing[dollers1]<<"元"<<endl;
  25.         system("cls");
  26.     }
  27.     cout<<"你抽中:"<<thing[dollers1]<<"元"<<"!"<<endl<<endl;
  28.     cout<<"第2次抽獎你抽中什麼呢?"<<endl<<endl;
  29.     system("pause");
  30.     system("cls");
  31.     for(int i=0;i<=150;i++)
  32.     {
  33.         dollers2=rand()%5;
  34.         if(i%2==0)
  35.             cout<<"***抽獎中...***"<<endl;
  36.         else
  37.             cout<<"*******抽獎中...*******"<<endl;   
  38.         cout<<thing[dollers2]<<"元"<<endl;
  39.         system("cls");
  40.     }
  41.     cout<<"你抽中:"<<thing[dollers2]<<"元"<<"!"<<endl<<endl;        
  42.     int have;
  43.     int shop;
  44.     int player1;
  45.     cout<<"<1>要 <2>不要"<<endl;
  46.     cin>>have;
  47.     if(have==1)
  48.     {
  49.         cout<<"恭喜你得到"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;
  50.         cout<<"請問您要去購物中心購買商品嗎?"<<endl;
  51.         cout<<"<1>要 <2>不要"<<endl;
  52.         cin>>shop;
  53.         if(shop==1)
  54.         {  
  55.             reset:                 
  56.             system("cls");
  57.             int p,pay=0,popo,money,opt,sum=0;
  58.             string name[5]={"砍頭優惠卷","特效搖頭丸","自殺體驗卷","被打免費票","舒柔鼻涕蟲",};
  59.             int price[5]={200,500,5000,10000,10500};
  60.             cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
  61.             cout<<"[商品價目表]"<<endl;
  62.             int qty[5]={0,0,0,0,0};
  63.             cout<<"你可以消費"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;
  64.             for(int i=0; i<5; i++)
  65.             {
  66.                 cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  67.             }
  68.             cout<<"(8)結帳"<<endl<<endl;
  69.             re:
  70.             cout<<"請輸入商品代碼: ";
  71.             cin>>p;
  72.             if(p==8)
  73.                 goto checkout;
  74.             else if(p>=1 && p<=7)
  75.             {
  76.                 cout<<"數量: ";
  77.                 cin>>popo;
  78.                 if(popo<=0)
  79.                 {
  80.                     cout<<"輸入錯誤!"<<endl;
  81.                     goto re;        
  82.                 }
  83.                 sum+=price[p-1]*popo;
  84.                 qty[p-1]+=popo;     
  85.             }
  86.             else
  87.             {
  88.                 cout<<"輸入錯誤!"<<endl;   
  89.             }
  90.             goto re;
  91.             checkout:   
  92.             cout<<endl<<"噁心清單"<<endl;
  93.             cout<<"----------------------------------"<<endl;
  94.             for (int i=0;i<5;i++)
  95.             {
  96.                 if(qty[i]!=0)
  97.                     cout<<name[i]<<"\t"<<price[i]<<"元  *  "<<qty[i]<<"個"<<endl;        
  98.             }   
  99.             cout<<"----------------------------------"<<endl;
  100.             cout<<"總共"<<sum<<"元!"<<endl<<endl;
  101.             cout<<"1-正確無誤"<<endl<<"2-重新選購"<<endl;
  102.             cin>>opt;
  103.             if(opt==1)
  104.             {
  105.                 goto change;         
  106.             }
  107.             if(opt==2)
  108.             {
  109.                 goto reset;         
  110.             }
  111.             change:   
  112.              /*   
  113.                 cout<<"請付錢:";
  114.                 cin>>pay;
  115.                
  116.             if(pay<=0)
  117.             {
  118.                 cout<<endl<<"你是誰啊?!"<<endl<<endl;
  119.                 goto change;      
  120.             }
  121.             */
  122.             if(sum>thing[dollers1]+thing[dollers2])
  123.             {
  124.                     cout<<"騙人!!你明明只得到"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;        
  125.                     goto reset;      
  126.             }
  127.             money=thing[dollers1]+thing[dollers2]-sum;
  128.             if(money==0)
  129.             {
  130.                 cout<<endl<<"剛剛好! 銘謝惠顧!"<<endl<<endl;  
  131.             }
  132.             else
  133.             {
  134.                 cout<<endl<<"需找客人"<<money<<"元"<<endl<<endl;
  135.                 if(money>=500)
  136.                 {
  137.                     cout<<"五百元鈔票"<<money/500<<"張"<<endl;
  138.                     money%=500;   //money=money%500;            
  139.                 }
  140.                 if(money>=100)
  141.                 {
  142.                     cout<<"一百元鈔票"<<money/100<<"張"<<endl;
  143.                     money%=100;               
  144.                 }
  145.                 if(money>=50)
  146.                 {
  147.                     cout<<"五十元硬幣"<<money/50<<"枚"<<endl;
  148.                     money%=50;                  
  149.                 }
  150.                 if(money>=10)
  151.                 {
  152.                     cout<<"十元硬幣"<<money/10<<"枚"<<endl;
  153.                     money%=10;                  
  154.                 }
  155.                 if(money>=5)
  156.                 {
  157.                     cout<<"五元硬幣"<<money/5<<"枚"<<endl;
  158.                     money%=5;               
  159.                 }
  160.                 if(money>=1)
  161.                 {
  162.                     cout<<"一元硬幣"<<money<<"枚"<<endl;            
  163.                 }
  164.                
  165.                 cout<<endl;
  166.                 system("pause");
  167.             }
  168.         }   
  169.         if(shop==2)
  170.         {
  171.             cout<<"還有剪刀石頭布的遊戲您要玩嗎?"<<endl;
  172.             cout<<"(1)我要去玩 (2)謝謝!下次再來玩"<<endl;
  173.             cin>>player1;
  174.             if(player1==1)
  175.             {  
  176.                 goto  pp;            
  177.             }
  178.             if(player1==2)
  179.             {
  180.                 goto allre;
  181.             }
  182.         }
  183.     }         
  184.     if(have==2)
  185.     {
  186.          cout<<"你拒絕了嗎?有機會再來唷!!"<<endl;
  187.          system("pause");
  188.          goto allre;
  189.     }
  190.     srand(time(NULL));
  191.     pp:
  192.     system("cls");
  193.     int g, c;
  194.     alllre:
  195.     string name[5]={"改去購物中心","退出遊戲","剪刀","石頭","布"};
  196.     cout<<"請選擇! <1>去中信彩券行 <2>退出遊戲 <3>剪刀 <4>石頭 <5>布 <6>戰績歸零 <7>觀看結果 ";
  197.     cin>>g;
  198.     if(g==7)
  199.         goto result;
  200.     else if(g==6)
  201.     {
  202.          sum2=0; lose=0; same=0;
  203.          goto pp;
  204.     }else if(g==1)
  205.             goto d;
  206.     else if(g==2)
  207.             goto allre;            
  208.     else
  209.     {
  210.         cout<<"你出"<<name[g-1]<<"!"<<endl;
  211.         c=rand()%3+3;
  212.         cout<<"電腦出"<<name[c-1]<<"!"<<endl;
  213.         if(g-c==1)
  214.         {
  215.             cout<<"你贏了!!"<<endl;
  216.             sum2+=1;
  217.         }   
  218.         else if(g-c==-2)
  219.         {
  220.             cout<<"你贏了!!"<<endl;
  221.             sum2+=1;
  222.         }   
  223.         else if(c==g)
  224.         {
  225.            cout<<"平手!!"<<endl;
  226.             same+=1;
  227.         }   
  228.                                                    
  229.         else
  230.         {
  231.             cout<<"你輸了!!"<<endl;
  232.             lose+=1;
  233.         }
  234.         system("pause");
  235.         goto pp;
  236.     }           
  237.     result:
  238.     cout<<"***戰果統計***"<<endl;
  239.     cout<<"總共贏了"<<sum2<<"次"<<endl;
  240.     cout<<"總共平手"<<same<<"次"<<endl;
  241.     cout<<"總共輸了"<<lose<<"次"<<endl;
  242.     system("pause");
  243.     goto pp;
  244.     d:
  245.     system("pause");
  246.     srand(time(NULL));
  247.     int lotol, can;
  248.     cout<<"歡迎來到中信彩券行"<<endl;
  249.     cout<<"請輸入一個數(1~10):"<<endl;
  250.     cin>>lotol;
  251.     for(int i=1;i>=0;i++)
  252.     {
  253.         cout<<"你已被電腦病毒侵犯>_<!"<<"/a"<<"/n"<<endl;         
  254.     }     
  255.     system("pause");
  256.     return 0;   
  257. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     allre:
  7.     system("cls");
  8.     int thing[5]={100,500,1000,5000,10000};
  9.     int dollers1;
  10.     int dollers2;
  11.     srand(time(NULL));
  12.     cout<<"***抽獎大會***"<<endl;
  13.     cout<<"第1次抽獎你抽中什麼呢?"<<endl<<endl;
  14.     system("pause");
  15.     system("cls");
  16.     for(int i=0;i<=150;i++)
  17.     {
  18.         dollers1=rand()%5;
  19.         if(i%2==0)
  20.             cout<<"***抽獎中...***"<<endl;
  21.         else
  22.             cout<<"*******抽獎中...*******"<<endl;   
  23.         cout<<thing[dollers1]<<"元"<<endl;
  24.         system("cls");
  25.     }
  26.     cout<<"你抽中:"<<thing[dollers1]<<"元"<<"!"<<endl<<endl;
  27.     cout<<"第2次抽獎你抽中什麼呢?"<<endl<<endl;
  28.     system("pause");
  29.     system("cls");
  30.     for(int i=0;i<=150;i++)
  31.     {
  32.         dollers2=rand()%5;
  33.         if(i%2==0)
  34.             cout<<"***抽獎中...***"<<endl;
  35.         else
  36.             cout<<"*******抽獎中...*******"<<endl;   
  37.         cout<<thing[dollers2]<<"元"<<endl;
  38.         system("cls");
  39.     }
  40.     cout<<"你抽中:"<<thing[dollers2]<<"元"<<"!"<<endl<<endl;        
  41.     int have;
  42.     int shop;
  43.     int player1;
  44.     cout<<"<1>要 <2>不要"<<endl;
  45.     cin>>have;
  46.     if(have==1)
  47.     {
  48.         cout<<"恭喜你得到"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;
  49.         cout<<"請問您要去購物中心購買商品嗎?"<<endl;
  50.         cout<<"<1>要 <2>不要"<<endl;
  51.         cin>>shop;
  52.         if(shop==1)
  53.         {  
  54.             reset:                 
  55.             system("cls");
  56.             int p,pay=0,popo,money,opt,sum=0;
  57.             string name[5]={"砍頭優惠卷","特效搖頭丸","自殺體驗卷","被打免費票","舒柔鼻涕蟲",};
  58.             int price[5]={200,500,5000,10000,10500};
  59.             cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
  60.             cout<<"[商品價目表]"<<endl;
  61.             int qty[5]={0,0,0,0,0};
  62.             cout<<"你可以消費"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;
  63.             for(int i=0; i<5; i++)
  64.             {
  65.                 cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  66.             }
  67.             cout<<"(8)結帳"<<endl<<endl;
  68.             re:
  69.             cout<<"請輸入商品代碼: ";
  70.             cin>>p;
  71.             if(p==8)
  72.                 goto checkout;
  73.             else if(p>=1 && p<=7)
  74.             {
  75.                 cout<<"數量: ";
  76.                 cin>>popo;
  77.                 if(popo<=0)
  78.                 {
  79.                     cout<<"輸入錯誤!"<<endl;
  80.                     goto re;        
  81.                 }
  82.                 sum+=price[p-1]*popo;
  83.                 qty[p-1]+=popo;     
  84.             }
  85.             else
  86.             {
  87.                 cout<<"輸入錯誤!"<<endl;   
  88.             }
  89.             goto re;
  90.             checkout:   
  91.             cout<<endl<<"噁心清單"<<endl;
  92.             cout<<"----------------------------------"<<endl;
  93.             for (int i=0;i<5;i++)
  94.             {
  95.                 if(qty[i]!=0)
  96.                     cout<<name[i]<<"\t"<<price[i]<<"元  *  "<<qty[i]<<"個"<<endl;        
  97.             }   
  98.             cout<<"----------------------------------"<<endl;
  99.             cout<<"總共"<<sum<<"元!"<<endl<<endl;
  100.             cout<<"1-正確無誤"<<endl<<"2-重新選購"<<endl;
  101.             cin>>opt;
  102.             if(opt==1)
  103.             {
  104.                 goto change;         
  105.             }
  106.             if(opt==2)
  107.             {
  108.                 goto reset;         
  109.             }
  110.             change:   
  111.              /*   
  112.                 cout<<"請付錢:";
  113.                 cin>>pay;
  114.                
  115.             if(pay<=0)
  116.             {
  117.                 cout<<endl<<"你是誰啊?!"<<endl<<endl;
  118.                 goto change;      
  119.             }
  120.             */
  121.             if(sum>thing[dollers1]+thing[dollers2])
  122.             {
  123.                     cout<<"騙人!!你明明只得到"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;        
  124.                     goto reset;      
  125.             }
  126.             money=thing[dollers1]+thing[dollers2]-sum;
  127.             if(money==0)
  128.             {
  129.                 cout<<endl<<"剛剛好! 銘謝惠顧!"<<endl<<endl;  
  130.             }
  131.             else
  132.             {
  133.                 cout<<endl<<"需找客人"<<money<<"元"<<endl<<endl;
  134.                 if(money>=500)
  135.                 {
  136.                     cout<<"五百元鈔票"<<money/500<<"張"<<endl;
  137.                     money%=500;   //money=money%500;            
  138.                 }
  139.                 if(money>=100)
  140.                 {
  141.                     cout<<"一百元鈔票"<<money/100<<"張"<<endl;
  142.                     money%=100;               
  143.                 }
  144.                 if(money>=50)
  145.                 {
  146.                     cout<<"五十元硬幣"<<money/50<<"枚"<<endl;
  147.                     money%=50;                  
  148.                 }
  149.                 if(money>=10)
  150.                 {
  151.                     cout<<"十元硬幣"<<money/10<<"枚"<<endl;
  152.                     money%=10;                  
  153.                 }
  154.                 if(money>=5)
  155.                 {
  156.                     cout<<"五元硬幣"<<money/5<<"枚"<<endl;
  157.                     money%=5;               
  158.                 }
  159.                 if(money>=1)
  160.                 {
  161.                     cout<<"一元硬幣"<<money<<"枚"<<endl;            
  162.                 }
  163.                
  164.                 cout<<endl;
  165.             }
  166.         }   
  167.         if(shop==2)
  168.         {
  169.             cout<<"還有剪刀石頭布的遊戲您要玩嗎?"<<endl;
  170.             cout<<"(1)我要去玩 (2)謝謝!下次再來玩"<<endl;
  171.             cin>>player1;
  172.             if(player1==1)
  173.             {  
  174.                 goto  pp;            
  175.             }
  176.             if(player1==2)
  177.             {
  178.                 goto allre;
  179.             }
  180.         }
  181.     }         
  182.     if(have==2)
  183.     {
  184.          cout<<"你拒絕了嗎?有機會再來唷!!"<<endl;
  185.          system("pause");
  186.          goto allre;
  187.     }
  188.     srand(time(NULL));
  189.     pp:
  190.     system("cls");
  191.     int g, c, sum2=0, lose=0, same=0;
  192.     alllre:
  193.     string name[5]={"改去購物中心","退出遊戲","剪刀","石頭","布"};
  194.     cout<<"請選擇! <1>改去購物中心 <2>退出遊戲 <3>剪刀 <4>石頭 <5>布 <6>戰績歸零 <7>觀看結果 ";
  195.     cin>>g;
  196.     if(g==7)
  197.         goto result;
  198.     else if(g==6)
  199.             goto pp;
  200.     else if(g==1)
  201.             goto reset;
  202.     else if(g==2)
  203.             goto allre;            
  204.     else
  205.     {
  206.         cout<<"你出"<<name[g-1]<<"!"<<endl;
  207.         c=rand()%3+3;
  208.         cout<<"電腦出"<<name[c-1]<<"!"<<endl;
  209.         if(g-c==1)
  210.         {
  211.             cout<<"你贏了!!"<<endl;
  212.             sum2+=1;
  213.         }   
  214.         else if(g-c==-2)
  215.         {
  216.             cout<<"你贏了!!"<<endl;
  217.             sum2+=1;
  218.         }   
  219.         else if(c==g)
  220.         {
  221.            cout<<"平手!!"<<endl;
  222.             same+=1;
  223.         }   
  224.                                                    
  225.         else
  226.         {
  227.             cout<<"你輸了!!"<<endl;
  228.             lose+=1;
  229.         }
  230.         system("pause");
  231.         goto pp;
  232.     }           
  233.     result:
  234.     cout<<"***戰果統計***"<<endl;
  235.     cout<<"總共贏了"<<sum2<<"次"<<endl;
  236.     cout<<"總共平手"<<same<<"次"<<endl;
  237.     cout<<"總共輸了"<<lose<<"次"<<endl;
  238.     system("pause");
  239.     goto pp;
  240.     return 0;
  241. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     allre:
  7.     system("cls");
  8.     int thing[5]={100,500,1000,5000,10000};
  9.     int dollers1;
  10.     int dollers2;
  11.     srand(time(NULL));
  12.     cout<<"***抽獎大會***"<<endl;
  13.     cout<<"第1次抽獎你抽中什麼呢?"<<endl<<endl;
  14.     system("pause");
  15.     system("cls");
  16.     for(int i=0;i<=150;i++)
  17.     {
  18.         dollers1=rand()%5;
  19.         if(i%2==0)
  20.             cout<<"***抽獎中...***"<<endl;
  21.         else
  22.             cout<<"*******抽獎中...*******"<<endl;   
  23.         cout<<thing[dollers1]<<"元"<<endl;
  24.         system("cls");
  25.     }
  26.     cout<<"你抽中:"<<thing[dollers1]<<"元"<<"!"<<endl<<endl;
  27.     cout<<"第2次抽獎你抽中什麼呢?"<<endl<<endl;
  28.     system("pause");
  29.     system("cls");
  30.     for(int i=0;i<=150;i++)
  31.     {
  32.         dollers2=rand()%5;
  33.         if(i%2==0)
  34.             cout<<"***抽獎中...***"<<endl;
  35.         else
  36.             cout<<"*******抽獎中...*******"<<endl;   
  37.         cout<<thing[dollers2]<<"元"<<endl;
  38.         system("cls");
  39.     }
  40.     cout<<"你抽中:"<<thing[dollers2]<<"元"<<"!"<<endl<<endl;        
  41.     int have;
  42.     int shop;
  43.     cout<<"<1>要 <2>不要"<<endl;
  44.     cin>>have;
  45.     if(have==1)
  46.     {
  47.         cout<<"恭喜你得到"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;
  48.         cout<<"請問您要去購物中心購買商品嗎?"<<endl;
  49.         cout<<"<1>要 <2>不要"<<endl;
  50.         cin>>shop;
  51.         if(shop==1)
  52.         {  
  53.             reset:                 
  54.             //system("cls");
  55.             int p,pay=0,popo,money,opt,sum=0;
  56.             string name[5]={"砍頭優惠卷","特效搖頭丸","自殺體驗卷","被打免費票","舒柔鼻涕蟲",};
  57.             int price[5]={200,500,5000,10000,10500};
  58.             cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
  59.             cout<<"[商品價目表]"<<endl;
  60.             int qty[5]={0,0,0,0,0};
  61.             cout<<"你可以消費"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;
  62.             for(int i=0; i<5; i++)
  63.             {
  64.                 cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  65.             }
  66.             cout<<"(8)結帳"<<endl<<endl;
  67.             re:
  68.             cout<<"請輸入商品代碼: ";
  69.             cin>>p;
  70.             if(p==8)
  71.                 goto checkout;
  72.             else if(p>=1 && p<=7)
  73.             {
  74.                 cout<<"數量: ";
  75.                 cin>>popo;
  76.                 if(popo<=0)
  77.                 {
  78.                     cout<<"輸入錯誤!"<<endl;
  79.                     goto re;        
  80.                 }
  81.                 sum+=price[p-1]*popo;
  82.                 qty[p-1]+=popo;     
  83.             }
  84.             else
  85.             {
  86.                 cout<<"輸入錯誤!"<<endl;   
  87.             }
  88.             goto re;
  89.             checkout:   
  90.             cout<<endl<<"噁心清單"<<endl;
  91.             cout<<"----------------------------------"<<endl;
  92.             for (int i=0;i<5;i++)
  93.             {
  94.                 if(qty[i]!=0)
  95.                     cout<<name[i]<<"\t"<<price[i]<<"元  *  "<<qty[i]<<"個"<<endl;        
  96.             }   
  97.             cout<<"----------------------------------"<<endl;
  98.             cout<<"總共"<<sum<<"元!"<<endl<<endl;
  99.             cout<<"1-正確無誤"<<endl<<"2-重新選購"<<endl;
  100.             cin>>opt;
  101.             if(opt==1)
  102.             {
  103.                 goto change;         
  104.             }
  105.             if(opt==2)
  106.             {
  107.                 goto reset;         
  108.             }
  109.             change:   
  110.              /*   
  111.                 cout<<"請付錢:";
  112.                 cin>>pay;
  113.                
  114.             if(pay<=0)
  115.             {
  116.                 cout<<endl<<"你是誰啊?!"<<endl<<endl;
  117.                 goto change;      
  118.             }
  119.             */
  120.             if(sum>thing[dollers1]+thing[dollers2])
  121.             {
  122.                     cout<<"騙人!!你明明只得到"<<thing[dollers1]+thing[dollers2]<<"元"<<"!"<<endl;        
  123.                     goto reset;      
  124.             }
  125.             money=thing[dollers1]+thing[dollers2]-sum;
  126.             if(money==0)
  127.             {
  128.                 cout<<endl<<"剛剛好! 銘謝惠顧!"<<endl<<endl;  
  129.             }
  130.             else
  131.             {
  132.                 cout<<endl<<"需找客人"<<money<<"元"<<endl<<endl;
  133.                 if(money>=500)
  134.                 {
  135.                     cout<<"五百元鈔票"<<money/500<<"張"<<endl;
  136.                     money%=500;   //money=money%500;            
  137.                 }
  138.                 if(money>=100)
  139.                 {
  140.                     cout<<"一百元鈔票"<<money/100<<"張"<<endl;
  141.                     money%=100;               
  142.                 }
  143.                 if(money>=50)
  144.                 {
  145.                     cout<<"五十元硬幣"<<money/50<<"枚"<<endl;
  146.                     money%=50;                  
  147.                 }
  148.                 if(money>=10)
  149.                 {
  150.                     cout<<"十元硬幣"<<money/10<<"枚"<<endl;
  151.                     money%=10;                  
  152.                 }
  153.                 if(money>=5)
  154.                 {
  155.                     cout<<"五元硬幣"<<money/5<<"枚"<<endl;
  156.                     money%=5;               
  157.                 }
  158.                 if(money>=1)
  159.                 {
  160.                     cout<<"一元硬幣"<<money<<"枚"<<endl;            
  161.                 }
  162.                
  163.                 cout<<endl;
  164.             }
  165.         }   
  166.         if(shop==2)
  167.         {
  168.              cout<<"你拒絕了嗎?有機會再來唷!!"<<endl;
  169.              goto allre;
  170.         }
  171.     }         
  172.     if(have==2)
  173.          cout<<"你拒絕了嗎?有機會再來唷!!"<<endl;
  174.     system("pause");
  175.     goto allre;
  176.     return 0;
  177. }
複製代碼

TOP

本帖最後由 洪振庭 於 2015-5-30 10:58 編輯
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"古靈閣年度抽獎大會  大獎一千萬加隆"<<endl;
  7.     cout<<"(每次七十加隆)"<<endl;
  8.     re:   
  9.     string name[5]={"痛苦麻瓜安樂死手術","免費爆尾釘蝦養育課","與佛地魔王一同遊玩","和巨人/龍生活夏令營","女催狂魔的深情之吻"};
  10.     int ball;  
  11.     srand(time(NULL));
  12.    
  13.     system("pause");
  14.     system("cls");
  15.     for(int i=0;i<=50;i++)
  16.     {
  17.             ball=rand()%5;
  18.             if(i%2==0)
  19.                 cout<<"121抽取中212"<<endl;
  20.             else
  21.                 cout<<"212抽取中121"<<endl;
  22.               cout<<name[ball]<<endl;
  23.               system("cls");      
  24.     }
  25.     cout<<"恭喜抽中"<<name[ball]<<endl<<endl;
  26.    
  27.     cout<<"(廣告)訂購古靈閣投資周刊請找古靈閣妖精"<<endl;
  28.    
  29.     cout<<"古靈閣年度抽獎大會是騙錢活動。  傳言是騙人的"<<endl;
  30.     goto re;        
  31.    system("pause");
  32.    return 0;
  33. }

  34.                  
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     system("cls");
  8.     string name[7]={"吃下姬路瑞希的殺人料理","被島田美波以暴力虐殺","被霧島翔子路過電死","被悶聲色狼威脅自殺","被臭老太婆長玩死","被?本雄二精神虐待致死","被工藤愛子在飯裡偷偷下藥"};
  9.     srand(time(NULL));
  10.     int ball;
  11.     cout<<"來抽笨蛋吉井的死法..."<<endl;
  12.     cout<<"明久:等等等等一下!為什麼我要死!?"<<endl;
  13.     cout<<"雄二:因為你欠死"<<endl;
  14.     system("pause");
  15.     system("cls");
  16.     for(int i=1;i<=80;i++)
  17.     {
  18.          ball=rand()%7;
  19.          if(i%2==0)
  20.              cout<<"▏▎▍▌▋▊▉█... 抽死法中 ... █▉▊▋▌▍▎▏"<<endl;
  21.          else
  22.              cout<<"█▉▊▋▌▍▎▏... 抽死法中 ... ▏▎▍▌▋▊▉█"<<endl;
  23.          cout<<name[ball];
  24.          system("cls");
  25.     }
  26.     cout<<"吉井明久將要以"<<name[ball]<<"方式死亡"<<endl;
  27.     cout<<"明久:等等等等一下我還不想死啊啊啊啊啊啊!"<<endl
  28.         <<"雄二:你沒有選擇的餘地"<<endl
  29.         <<"明久:我未來的美好人生呢?"<<endl
  30.         <<"悶聲色狼:......(冷笑)"<<endl
  31.         <<"工藤愛子:否決 ?"<<endl;
  32.     system("pause");
  33.     goto re;
  34.     return 0;   
  35. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     system("cls");
  8.     string name[5]={"一顆頭顱","一顆0.2mm*0.2mm的小石頭","一個裡大蜷","一台時速0.0000001mm/h的布卡迪","裡大蜷的頭顱(有鮮血>_<)"};
  9.     int thing;
  10.     srand(time(NULL));
  11.     cout<<"***抽獎大會***"<<endl;      
  12.     cout<<"這次抽獎你抽中什麼呢?"<<endl<<endl;
  13.     system("pause");
  14.     system("cls");
  15.     for(int i=0;i<=150;i++)
  16.     {
  17.        thing=rand()%5;
  18.        if(i%2==0)
  19.            cout<<"***抽獎中...***"<<endl;
  20.        else
  21.            cout<<"*******抽獎中...*******"<<endl;   
  22.        cout<<name[thing]<<endl;
  23.        system("cls");
  24.      }
  25.      cout<<"你抽中:"<<name[thing]<<"!"<<endl<<endl;
  26.      int have;
  27.      cout<<"<1>要 <2>不要"<<endl;
  28.      cin>>have;
  29.      if(have==1)
  30.         cout<<"恭喜你得到"<<name[thing]<<"!"<<endl;
  31.      if(have==2)
  32.         cout<<"你拒絕了嗎?有機會再來唷!!"<<endl;
  33.      system("pause");
  34.      goto re;
  35.      return 0;
  36. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     system("cls");
  8.     string name[5]={"一顆頭顱","一顆0.2mm*0.2mm的小石頭","一個裡大蜷","一台時速0.0000001mm/h的布卡迪","裡大蜷的頭顱(有鮮血>_<)"};
  9.     int thing;
  10.     srand(time(NULL));
  11.     cout<<"***抽獎大會***"<<endl;      
  12.     cout<<"這次抽獎你抽中什麼呢?"<<endl<<endl;
  13.     system("pause");
  14.     system("cls");
  15.     for(int i=0;i<=150;i++)
  16.     {
  17.        thing=rand()%5;
  18.        if(i%2==0)
  19.            cout<<"***抽獎中...***"<<endl;
  20.        else
  21.            cout<<"*******抽獎中...*******"<<endl;   
  22.        cout<<name[thing]<<endl;
  23.        system("cls");
  24.      }
  25.      cout<<"你抽中:"<<name[thing]<<"!"<<endl<<endl;
  26.      system("pause");
  27.      goto re;
  28.      return 0;
  29. }
複製代碼

TOP

返回列表