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

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 Program

Enter First 3 strings:
90
55
70

The list of orignal strings:
90
55
70

The list of changed strings:
09
55
07