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
|
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
int number[2], t, x;
srand(time(0));
char letter[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
for(t=0;t<2;t++)
{
number[t] = rand() % 26;
}
for(t=0;t<2;t++)
{
x=number[t];
cout << "" << "\n";
cout << letter[x] << "\n";
cout << "n";
cout << t+1;
cout << " = ";
cout << x << "\n";
}
}
|