I'm trying to make a 5x10 matrix with full of random letters and once the letter is used, it shouldn't be used again. 25 of them have to be small letters, 25 ought to be big letters. Even numbered columns should be small letters too. I don't know how to avoid using same letters. I tried to send the letters used to another array made of one dimension, then check every letter sent by it so that same letter won't be used but my coding skills didn't let me do it. So, my code is this so far:
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <ctime>
#include <locale.h>
using namespace std;
const int row = 5;
const int column = 10;
int main()
{
char matris[row][column];
srand(time(0));
for (int i = 0; i < row; i++)
for (int j = 0; j < column; j++)
if(j % 2 == 0)
matris[i][j] = rand() % 25 + 65;
else
matris[i][j] = rand() % 25 + 97;
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
cout << setw(5) << matris[i][j];
cout << endl;
}
system("pause");
return 0;
}
So, how can I avoid using same letters? Did I approach wrongly? Is there a easier way to do what I'm trying to do? Thanks...