Here you will get 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 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
Enter 3 strings:
how
are
you
The list of orignal strings:
how
are
you
The list of changed strings:
woh
era
uoy
Very Good work yar…..
there are too much silly mistakes and error in that program.please fix it