HomeC++

C++ Program to Reverse All the Strings Stored in an Array

C++ Program to Reverse All the Strings Stored in an Array
Like Tweet Pin it Share Share Email

Today we make a simple C++ Program to Reverse All the Strings Stored in an Array.In This program we See how we Get number and show Result.

C++ Program to Reverse All the Strings Stored in an Array

#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
char a[3][50];
int i,j,k,len;
cout<<"Enter First 3 strings:\n";

for(i=0;i<3;i++)
{
gets(a[i]);
}

cout<<"\nThe list of orignal strings:\n" ;

for(i=0;i<3;i++)
{
cout<<a[i]<<"\n";
}

cout<<"\nThe list of changed strings:\n";

for(i=0;i<3;i++)
{
len=strlen(a[i]);
for(j=0,k=len-1;k>=0;j++,k--)
{
cout<<a[i][k];
}

cout<<"\n";
}

return 0;
}

Output of ProgramC++ Program to Reverse All the Strings Stored in an Array

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *