classes

what is the purpose of getter and setter function in classes.
Last edited on
The standard library provides a function for this: http://www.cplusplus.com/reference/algorithm/reverse/
( Actually, two functions: http://www.cplusplus.com/reference/algorithm/reverse_copy/ )
An easy way to reverse a array can be done in many ways.

I've just recently wrote a program that does it like this:

1
2
3
4
5
6
7
8
9
void ReverseArray(char myArray[])
{
         int        index;
        
         for (index = strlen(myArray) - 1; index >= 0; --index)
              {
               cout << myArray[index];
              }
}


Easy as 3.14

EDIT: Whoops had my index set to zero before. My bad.
Last edited on
You need to set index to the size of the array-1 for that to work.
thanx guys
Topic archived. No new replies allowed.