//========================
//Program in Cpp to learn to reverse a strings in Cpp, strrevcpp3.cpp
//========================
#include<iostream>
using namespace std;
int main()
{
char orgstr[]="manoj";
cout<<"\n original string is:\n\n"<<orgstr<<"\n";
int i,j,c;
for(i=0,j=strlen(orgstr)-1;i<j;i++,j--)
{
c=orgstr[i];
orgstr[i]=orgstr[j];
orgstr[j]=c;
}
cout<<"\n Reversed String is: \n\n"<<orgstr<<"\n";
return 0;
}
//Program in Cpp to learn to reverse a strings in Cpp, strrevcpp3.cpp
//========================
#include<iostream>
using namespace std;
int main()
{
char orgstr[]="manoj";
cout<<"\n original string is:\n\n"<<orgstr<<"\n";
int i,j,c;
for(i=0,j=strlen(orgstr)-1;i<j;i++,j--)
{
c=orgstr[i];
orgstr[i]=orgstr[j];
orgstr[j]=c;
}
cout<<"\n Reversed String is: \n\n"<<orgstr<<"\n";
return 0;
}
How to reverse a string in C++ / CPP
ReplyDeleteHow to reverse a string in C++ / CPP
How to reverse a string in C++ / CPP
How to reverse a string in C++ / CPP
How to reverse a string in C++ / CPP