Question about Reversing a String

For my homework assignment, I'm suppose to be manipulating an input, and I'm currently stuck on the 'reversing' part of it.

1
2
3
   // Reversing the String
   Input = string(Input.rbegin(), Input.rend());
   cout << "\nYour input backwards is this:" << Input << endl;


It compiles, but it doesn't keep the case of the input. For ex: Hello World -> dlrow olleh instead of dlroW olleH.

Also would this code count as an array? Because we weren't suppose to use any.
1
2
3
4
5
6
7
8
9
10
   // Counting Vowels
   int numOfVowels = 0;
   for (int i = 0; i < Input.length(); i++)
   {
      if (Input[i] == 'a' || Input[i] == 'e' || Input[i] == 'i' || Input[i] == 'o'
         || Input[i] == 'u' || Input[i] == 'A' || Input[i] == 'E' || Input[i] == 'I'
         || Input[i] == 'O' || Input[i] == 'U')
         numOfVowels++;
   }
   cout << "\nThe number of vowels in your input line: " << numOfVowels << endl;


If it is. How would I go about changing it to a non array..?
Topic archived. No new replies allowed.