im working on a program that reads a keyword. The letters of the keyword must be inserted in the order in which they occur into a 5x5 two dimensional array
by rows, but if a letter is repeated in the keyword it is only used
once in the two-dimensional array. Then the array is filled up with
the remaining letters of the alphabet in order (excluding the 'Z').
the program will read in a series of lines containing either
messages to encrypt or decrypt.
i was able to create the matrix and i got stuck in the encrypt part. any help is appreciated!
#include <iostream>
#include <string>
using namespace std;
const int row = 5;
const int column = 5;
char arr[row][column] = { 0 };
//moving from Keyword and alphabet array
for (int i = 0; i < keyword.size(); i++) {
for (int j = 0; j < alphabet.size(); j++) {
if (keyword[i] == alphabet[j]) {
alphabet.erase(j, 1);
}
}
}
// building 5X5 array from Keyword and alphabet
keyword.append(alphabet);
int index = 0;
for (int row = 0; row < 5; row++) {
for (int column = 0; column < 5; column++) {
arr[row][column] = keyword[index];
index++;