Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to check equivalent of randomly generated alphabets?

muhammadmudassirmuhammadmudassir Member Posts: 0

//This code gives randomly generated alphabets and if equal will
//cout the alphabet which is equal
1 #include
2 #include
3 #include
4 using namespace std;
5 int main()
6 {
7 int a;
8 char array[10];
9 srand (time(0));
10 for (int i=0; i<10; i++)
11 {
12 a=rand() %26;
13 a=a+97;
14 array[i]=char(a);
15 }
16 for (int i=0; i<10; i++)
17 {
18 for (int j=0; j<10; j++)
19 {
20 if (array [i]==array [j]);
21 {
22 cout <<array[i] <<" " <<array[j];
23 }
24 cout << endl;
25 }
26 }
27 return 0;
28 } //program end

My question is how to check that randomly generated alphabets are equal e.g in 22 number line it should give output of equal alphabets if they are equal but it does not give equal alphabets what wrong in this code mention the wrong statement or help me how will i get right answer

Sign In or Register to comment.