Enter a string: house
(a)esuoH
(b)ESUOH
(c)esuoh
(d)EhuoS (Last and 2nd letter changed positions)

- I'm done with (b) and (c), and I don't know how to execute the remaining 2. Any suggestions?

Here's my code:

#include <iostream>
#include <string>
#include <locale>
using namespace std;

int main ()
{
do
  {		
   system("CLS");
   string input;
   cout<<"Enter a string: ";
   cin>> input;
   string str (input);
   cout<<"\n\n";

   locale loc;
  
  //for letter (b)
  string::reverse_iterator rit;
  for ( rit=str.rbegin() ; rit < str.rend(); rit++ )
    cout << toupper(*rit,loc);
	 cout<<"\n\n";
	//for letter (c)
  for ( rit=str.rbegin() ; rit < str.rend(); rit++ )
	cout << tolower(*rit,loc);
  cout<<"\n\n";
do
{	
 cout<<"Do you want to try again?: [y/n] ";
cin>>again;
}while(again!='Y'&&again!='y'&&again!='N'&&again!='n');
if (again=='n'||again=='N')
{
	system ("CLS");
	cout<<"\n\n\n\n";
	cout<<"Thank you for using this system.";
	cout<<"\n\n\n\n";
	return 0;
 }
}while(again=='Y'||again=='y');
  return 0;
}

For part a) make a copy. For that copy, uppercase the first letter. Print it backwards.

For part d) make a copy. Swap certain positions. Print out the copy
backwards.

For part a) make a copy. For that copy, uppercase the first letter. Print it backwards.

For part d) make a copy. Swap certain positions. Print out the copy
backwards.

-But i don't know how to code this..., any help?

-But i don't know how to code this..., any help?

something like this :

for part a :

string input = "";
cin >> input;
string copyInput = input;
copyInput[0] = toupper(copyInput[0] ); //make it upper case
//then print it backwards

I assume if you couldn't get this then the code you presented
is not completely yours?

You should write this

void main(){
        cout<<"Hello World.";
        system("pause");

        return 0;
            }

just declare again
like that...

    int main ()
    {
        char again;
        do
        {
        }while
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.