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