You do not understand while loops correctly, or, given the current evidence, general logic flow.
You have to specify everything.
while(str1 != '\0')
will loop until the array is equal to the null character. If the entire string does not equal the null character, it will keep looping. Since you never do set the string to a null character, it loops forever.
I believe the appropriate function would be a for loop for this case:
1 2 3 4
for(unsignedint x = 0; str[x] != '\0'; x++)
{
//display the "x"th character in the string, I'll leave this to you
}
The problem is the while-loop: Once the term is nut \0, the while loop will run into INFINITY.
you have to build a do while loop and question the enter at the very end or beginning ofvthe loop.
No. Please do not post unless you understand. The string will never be equal to "\0" because it is never set to "\0". You do not need a whle loop if you're just going to use cout.operator<<(constchar*) on it.