返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     int a, b, c;
  8.     int run=0 ;
  9.     int rase=0;
  10.     cout<<"$$$吃角子老虎機評估中獎機率程式$$$"<<endl;
  11.     cout<<"~中獎規則說明~"<<endl;
  12.     cout<<"任一欄出現一個7--> 獎金2倍 "<<endl;
  13.     cout<<"任兩欄出現兩個7--> 獎金10倍 "<<endl;
  14.     cout<<"三欄都出現7--> 獎金100倍 "<<endl;
  15.     cout<<"本次測試 試試看要轉幾次才會轉到第一特獎777 "<<endl;
  16.     system("pause");
  17.     srand(time(NULL));
  18.     while(true)
  19.     {
  20.        run++ ;
  21.        a=rand()%10;
  22.        b=rand()%10;
  23.        c=rand()%10;
  24.        cout<<a<<" "<<b<<" "<<c<<" "<<endl;
  25.     if(a==7 && b==7 && c==7)
  26.     {
  27.             break;
  28.     }
  29.     }
  30.     cout<<"~~~這是第一次轉到777~~~"<<endl;
  31.     cout<<""<<run<<"次"<<endl;
  32.     system("pause");
  33.     srand(time(NULL));
  34.     while(true)
  35.     {
  36.        rase++ ;
  37.        a=rand()%10;
  38.        b=rand()%10;
  39.        c=rand()%10;
  40.        cout<<a<<" "<<b<<" "<<c<<" "<<endl;
  41.     if(a==7 && b==7 && c==7)
  42.     {
  43.             break;
  44.     }
  45.     }
  46.     cout<<"~~~這是第二次轉到777~~~"<<endl;
  47.     cout<<"第一次跑了"<<rase<<"次才轉到777"<<endl;
  48.    
  49.       
  50.   system("pause");   
  51.   return 0;
  52. }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     int a, b, c;
  8.     int run=0 ;
  9.     cout<<"$$$吃角子老虎機評估中獎機率程式$$$"<<endl;
  10.     cout<<"~中獎規則說明~"<<endl;
  11.     cout<<"任一欄出現一個7--> 獎金2倍 "<<endl;
  12.     cout<<"任兩欄出現兩個7--> 獎金10倍 "<<endl;
  13.     cout<<"三欄都出現7--> 獎金100倍 "<<endl;
  14.     cout<<"本次測試 試試看要轉幾次才會轉到第二特獎777 "<<endl;
  15.      system("pause");
  16.     srand(time(NULL));
  17.     while(true)
  18.     {
  19.        run++ ;
  20.        a=rand()%10;
  21.        b=rand()%10;
  22.        c=rand()%10;
  23.        cout<<a<<" "<<b<<" "<<c<<" "<<endl;
  24.     if((a==7 && b==7 && c!=7) || (a!=7 && b==7 && c==7) || (a==7 && b!=7 && c==7))
  25.     {
  26.             break;
  27.     }
  28.     }
  29.     cout<<"共計"<<run<<"次"<<endl;
  30.    
  31.       
  32.   system("pause");   
  33.   return 0;
  34. }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5. int main()
  6. {
  7.     int a, b, c;
  8.     int run=0 ;
  9.     cout<<"$$$吃角子老虎機評估中獎機率程式$$$"<<endl;
  10.     cout<<"~中獎規則說明~"<<endl;
  11.     cout<<"任一欄出現一個7--> 獎金2倍 "<<endl;
  12.     cout<<"任兩欄出現兩個7--> 獎金10倍 "<<endl;
  13.     cout<<"三欄都出現7--> 獎金100倍 "<<endl;
  14.     cout<<"本次測試 試試看要轉幾次才會轉到第三特獎777 "<<endl;
  15.      system("pause");
  16.     srand(time(NULL));
  17.     while(true)
  18.     {
  19.        run++ ;
  20.        a=rand()%10;
  21.        b=rand()%10;
  22.        c=rand()%10;
  23.        cout<<a<<" "<<b<<" "<<c<<" "<<endl;
  24.     if((a==7 && b!=7 && c!=7) || (a!=7 && b==7 && c!=7) || (a!=7 && b!=7 && c==7))
  25.     {
  26.             break;
  27.     }
  28.     }
  29.     cout<<"共計"<<run<<"次"<<endl;
  30.    
  31.       
  32.   system("pause");   
  33.   return 0;
  34. }
複製代碼

TOP

返回列表