Just can't do it!

closed account (D2w0RXSz)
Create a program in which there is an array composed of 10 characteres inserted by the user. When the user's already inserted all characters the program must print it out in the inverse order which the characters were inserted.

thansk guiys
This isn't too difficult. You would need a char array of length 10 and 2 loops, 1 to pass from beginning to end (input), the other from end to beginning (output).
closed account (D2w0RXSz)
Hi there!

is this correct?


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
char request [10 ] = "Please enter 10 charecters : ";
int i;
for (i= 0; i <= 9; i++)


system("PAUSE");
return EXIT_SUCCESS;
}
Your char array, request, should be left uninitialised. The message "Please enter 10 characters" can be output as a literal using cout.

The for loop construction is correct, you should use it for scanning into request, but you will need another for loop (in the reverse direction) to output.
Topic archived. No new replies allowed.