版本比较
石头剪刀布
正文
增加 3 行删除 3 行
12344567891011111213141522 行未改动3839404142424344454611 行未改动```#include<bits/stdc++.h>#include <windows.h> // GetAsyncKeyState#include <conio.h> #include <conio.h>using namespace std; // _kbhit, _getch (用于非阻塞检测ESC)void cls() { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD topLeft = {0, 0}; SetConsoleCursorPosition(hConsole, topLeft);}//Player1使用asd来控制剪刀石头布,Player2使用bnm来控制剪刀石头布 //Player1使用asd来控制剪刀石头布,Player2使用bnm来控制剪刀石头布int main() { int wj1=0,wj2=0,cnt1=0,cnt2=0; CONSOLE_CURSOR_INFO cursor_info = {1, 0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);22 行未改动
if(wj1==0)cout<<"石头"; else if(wj1==1)cout<<"剪刀"; else cout<<"布 "; cout<<" vs "; cout<<" vs "; if(wj2==0)cout<<"石头"; else if(wj2==1)cout<<"剪刀"; else cout<<"布 "; cout<<endl;11 行未改动