1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <iostream>
#include <string>
#include <array>
#include <random>
#include <ctime>
#include<conio.h>
using namespace std;
int main()
{
char key;
int max = 25;
int asciiValue;
srand((unsigned) time(0));
int randomnumber = ((unsigned) rand() % max);
int randomnumber2 = ((unsigned) rand() % max);
const char* letters[26] = { "q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"};
for (int i = 0; i < 100; i++)
{
i = 0;
key = _getch();
asciiValue = key;
if (asciiValue == 27)
break;
if (asciiValue = 113)
{
cout << letters[randomnumber] << endl;
}
if (asciiValue = 101)
{
cout << letters[randomnumber2] << endl;
}
}
}
|