Followers

Friday, January 6, 2012

REVERSING A STRING-USING ANOTHER STRING


#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>

void main()
{
  char strng[25], rev[25];
  int len;
  cout<<"enter a string : ";
  gets(strng);
  len=strlen(strng);
  for(int i=0 ; i<len ; i++)
  {
    rev[i]=strng[len-1-i];
  }
  cout<<"\n\n reverse :\n";
  puts(rev);

  getch();
}
.................................................................
OUTPUT :(click to enlarge the image)

No comments:

Post a Comment