zoukankan      html  css  js  c++  java
  • 自闭版节奏大C

    1,2,3,4打碟

    #include <bits/stdc++.h>
    #include <conio.h>
    #include <windows.h> 
    
    using namespace std;
    
    char mmp[1000001][4];
    char putmmp[20][5];
    
    int main() {
        
        srand((unsigned)time(NULL));
        char ch;
        int d = rand() % 10 + 3;
        for (register int i = 1; i <= 1000000; i++) {
            
            mmp[i][0] = mmp[i][1] = mmp[i][2] = mmp[i][3] = ' ';
            
            if (i % d == 0 && i >= 40) {
                
                rand() % 10 + 3;
                mmp[i][rand() % 4] = '#';
                
            }
            
        }
        
        int wrong = 0, miss = 0;
        
        for (register int i = 1; i <= 1000/*可自行设置(<=1000000)*/; i++) {
        
            Sleep(40);
            for (register int j = i, l = 19; j <= i + 20; j++, l--) {
                
                for (register int k = 0; k < 4; k++) {
                    
                    putmmp[l][k] = mmp[j][k];
                    
                }
                putmmp[l][4] = '
    ';
                
            }
            system("cls");
            fwrite(putmmp, 1, 20 * 5, stdout);
            printf("1234");
            
            if (kbhit()) {
                
                ch = getch();
                
                if (mmp[i][ch - '1'] != '#') {
                    
                    wrong++;
                    
                }
                
            } else {
                
                if (mmp[i][0] == '#' || mmp[i][1] == '#' || mmp[i][2] == '#' || mmp[i][3] == '#') {
                    
                    miss++;
                    
                }
                
            }
                
        }
        system("cls");
        
        printf("wrong:%d  miss:%d
    ", wrong, miss);
        
        Sleep(500);
        
        return 0;
        
    }

    转载请注明©Ice_watermelon233

  • 相关阅读:
    RAM disk
    将2个物理磁盘做成4个逻辑卷
    LVM——基本概念
    服务器CPU架构演变过程
    IBM XIV
    011——一些貌似高逼格的词汇
    010——存储系统架构演变
    010——集群化
    009——虚拟化
    008——协议融合
  • 原文地址:https://www.cnblogs.com/Ice-watermelon233/p/Autistic_jiezoudaC.html
Copyright © 2011-2022 走看看