//Encryption of pass-phrase
char passReverse(char usrPass[]){
char newPass[pSize];
int value;
int randNum;
int rand_NumOut;
//Random number generation
srand(time(0));
randNum = rand();
rand_NumOut = ((randNum %12)+2);
//Reversing array for-loop
for (int i=0; i<pSize && usrPass[i] != '\0'; i++){
char letter = usrPass[i];
newPass[i] = letter;
int maxVal = strlen(usrPass);
if (maxVal >=0){
newPass[i] = usrPass[(maxVal-1)-i];
}
cout << newPass[i];
value = i;
}
return value;
}
Ideally the rand_NumOut would be placed in newPass[] immediately after the last loop.
The problem I have run into is that when placed in the for-loop, of course, rand_NumOut is placed after every char in the array, and when outside of the loop, I can’t place it in the array’s content.
Suggestions?
at the end of the for loop simply add the lines