Hello i'm quite new to c++ and have written a simple program that will decipher some text based on a transposition cipher. However my problem is that cin takes the input and stores it into a char array but when i press enter on my keyboard it does not move onto the next piece of code in the program it just continues to take input at console. any help would be greatly appreciated its been racking my brain!
// Decipher program by JM
#include <iostream>
usingnamespace std;
int main ()
{
cout << "Please enter the ciphertext and press enter: \n"; //display message to user
char plainText[100];
char inputArrayy[100];
int p = 0;
while(cin >> inputArrayy[p]) {
p++;
}
int n = 0;
int i = 0;
while (sizeof(inputArrayy)/sizeof(inputArrayy[0]) != sizeof(plainText)/sizeof(plainText[0])){
while (inputArrayy[n] == '*'){
n++;
}
plainText[i] = inputArrayy[n];
inputArrayy[n] = '*';
n = n+3%(sizeof(inputArrayy)/sizeof(inputArrayy[0]));
i++;
}
cout << plainText;
return 0;
}
yeah thats what i want, but it doesnt seem to work. The while loop just keeps looping, i think i'm going to have to take input and store it as a string, then convert that to a char array. now i just need to find out how to do that...lol