C Program to reverse all the strings stored in an array
#include<iostream.h>#include<conio.h>#include<string.h>#include<stdio.h>void main(){ clrscr(); char a[3][50]; int i,j,k,len; cout<<"Enter 3 strings:
";
for(i=0;i<3;i++) { gets(a[i]); } cout<<"
The list of orignal strings:
" ;
for(i=0;i<3;i++) { cout<<a[i]<<"
"; } cout<<"
The list of changed string:
";
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<<"
"; } getch();}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.