C++ Program to Reverse the String

 #include<iostream>

#include<iomanip>

#include<string.h>

using namespace std;

void line()

{

cout<<"========================================\n";

}

int main() 

{

        int i,n,j,size=0;

char arr[20],ch;

line();

cout<<"String Programs #11\n";

line();

cout<<"Enter Any values to the String :";

cin.getline(arr,20);

line();

for(n=0;arr[n]!='\0';n++);

for(i=0,j=n-1;i<n/2;i++,j--)

{

ch=arr[i];

arr[i]=arr[j];

arr[j]=ch;

}

cout<<endl<<arr;

}

Comments

Popular posts from this blog