I'm working on a simple program where it contains 2 or 3 simple games like hang man and tic tac toe. Here when user presses ESC anywhere in b/w it should exit, also when a user presses CTRL, it should switch game. How to do that?
#include "iostream"
#include "ctime"
#include "cstdlib"
#include "cstdio"
#include <stdlib.h>
using namespace std;
int main()
{
cout << "Test\n" << endl;
srand((int)time(0));
int s, x, run = 0;
cin >> s;
for (int i = 0; i < 6; ++i)
{
int r = rand() % 6 + 1;
if (r == s)
{
cout << "U:" << s << endl << "AI:" << r << endl << "OUT!!!";
break;
}
cout << "U:" << s << endl << "AI:" << r << endl;
run += s;
system("pause");
cin >> s;
system("cls");
}
cout << "total runs =" << run << endl;
system("pause");
}