| myka316 (11) | |||
|
This is basically what the problem looks like: Enter string to reverse: AMAZING Reversed string: ===============GNIZAMA Do you want to insert another string (Y/N)?: Y Enter string to reverse: NEVER Reversed string: ====================REVENMA Do you want to insert another string (Y/N)?: N Here is my code:
| |||
|
Last edited on
|
|||
| myka316 (11) | |
| Anyone? | |
|
|
|
| dudeman007 (58) | |
| It worked just fine for me. | |
|
|
|
| myka316 (11) | |
| Hmmm, could you possibly tell me what you entered to be reversed? Although I guess it doesn't really matter since I'm still getting the odd characters. Perhaps it might be old data from past debug runs. | |
|
|
|
| cire (2362) | |
Line 18 should be:cout << "Reversed String: " << user_input << endl ; And you can get rid of line 10. | |
|
Last edited on
|
|
| dudeman007 (58) | |
| Put in AMAZING and NEVER, same as you. | |
|
|
|
| Raezzor (277) | |
|
If you are asking why the MA at the end of the 2nd it might be since you use the same char array to store the input without resetting the null? Not sure exactly, to be honest. Honestly, if that was the case I would expect the 2nd output to be AMREVEN. Edit: Actually, it works fine for me too, after making the change cire suggested. Otherwise it simply output nothing, as you would expect from an empty char array. getline() must add the terminating null to the end of never anyway. | |
|
Last edited on
|
|