Advertisement
H0_0H

Untitled

Mar 7th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. typedef pair<int, int> PII;
  5. typedef pair<LL, LL> PLL;
  6.  
  7.  
  8.  
  9. int main(){
  10.     char c;
  11.     cout << "逢七必过小游戏" << endl;
  12.     cout << "输入y开始 输入n退出: " << endl;
  13.     cin >> c;
  14.  
  15.     if (c == 'y'){
  16.         int n;
  17.         while (1){
  18.             cout << "请输入1-100的整数: " << endl;
  19.             cin >> n;
  20.             if (n > 100 || n < 1){
  21.                 cout << "请输入正确的数字" << endl;
  22.                 cout << "---------------------------" << endl;
  23.                 continue;
  24.             }
  25.             else if (n % 7 == 0 || n % 10 == 7 || n % 10 == 7){
  26.                 cout << "游戏结束, 请重新开始 大傻子" << endl;
  27.                 cout << "---------------------------";
  28.                 continue;
  29.             }
  30.             else{
  31.                 for (int i = n; i <= 100; i++){
  32.                     if (i % 7 == 0 || i % 10 == 7 || i % 10 == 7)
  33.                         cout << i << endl;
  34.                     else cout << "PASS" << endl;
  35.                 }
  36.             }
  37.             break;
  38.         }
  39.     }
  40.     else if (c == 'n'){
  41.         cout << "退出成功" << endl;
  42.     }
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement