use getline() rather than >> to accept input into in.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
Yeah I tried that and I get the same result wont encrypt anything after a space.
I would guess then that the problem is that the out array is not initialized correctly. I see nowhere where you strcpy the in array to the out array before going through the loop. If you initialize out beforehand as all NULL, the first character that is not 'a' through 'z' is going to end the out string. I think you should either do a deep copy of the in array to the out array after getting a value for in and before the loop starts, or better yet, change all of those if statements to "else if" statements and then add an "else" branch for when characters (like spaces) aren't 'a' through 'z'. In that case you should assign out[i] to equal in[i].
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
Place this line:
cout << in << endl;
between these two lines:
cin >> in;
count = strlen(in);
and this line:
cout << count << endl;
after the second line above. If the appropriate results are printed to the screen then add this to the end of the if statements in your code to see if that helps.
else
out[i] = in[i];
If that doesn't work then post declaration for in and out and provide more code for us to look at.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396