This is simple but logic building program in C++ about string. The function in the program prompt to enter the string and return the string in reverse order.
Source Code
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<"\a\n\n\n"
<<"\t******************************************************"<<endl
<<"\t** **"<<endl
<<"\t** Welcome To **"<<endl
<<"\t** **"<<endl
<<"\t** String in reverse order **"<<endl
<<"\t** **"<<endl
<<"\t** Demo **"<<endl
<<"\t** **"<<endl
<<"\t******************************************************"<<endl
<<endl
<<endl;
cout<<"";
cout << "Enter your string: (Press Enter at the end)";
string string1;
getline(cin,string1,'\n');
for (int x = string1.size()-1; x >=0; x--){
cout << string1[x];
}
cout<<""<<endl;
cout<<""<<endl;
system("pause");
return 0;
}
0 comments:
Post a Comment