this my code for reversing and change small letters into capital vice versa....but problem is that when enter ehsan is good then it covert only is good and reverse only is good......without space it work...with space it does not work
first, do not mix string with string.h, they will cause conflicts.
The cause of your problem is that cin stops reading when it encounters spaces or newlines, thus causing unexpected results
If you want to read with spaces, use getline() instead: cin.getline ( input, 1000 );
or another version: getline ( cin, input ) // you need to include string
but the first is recommended
the 2 differ by in which you will store the processed input
the first example is recommended for c - string with limited length such as your input array which has a limit of 1000, the 1000 parameter in getline is used to limit the characters which maybe entered and stored into input, which otherwise if the characters entered is greater than the array it will cause unexpected results.
the 2nd is recommended for std::string types since string automatically manages memory, thus you will not need a limit...