I have working code of int array and I try to do exactly the same code but with char. Something goes wrong, I got some huge amount of symbols instead.
char size_ch_array; // Something crazy here!!!!!!!!!!!!!!!!!!!
cout << "Give me you size of Char Array" << endl;
cin >> input_ch_size1;
cin >> input_ch_size2;
char rand_ch_array [input_ch_size1] [input_ch_size2];
for (char m=0; m<input_ch_size1; m++)
for (char n=0; n<input_ch_size2; n++)
rand_ch_array [m] [n] = rand()%2;
cout << "Your crazy array" << endl;
for (char m=0; m<input_size1; m++)
for (char n=0; n<input_size2; n++)
cout << rand_ch_array [m] [n] << " " << flush;
cout << endl;
I want to do func rand()%26 // where 26 letters of abc. I want to see the array of my size from 'a' to 'f', of different 26 letters or less?
Aucun commentaire:
Enregistrer un commentaire