How to write a C++ Program to display a string reversed in C++ Programming ?
C++ Program to display a string reversed |
Solution:
//Program to display a string reversed.
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
void main()
{
clrscr();
char a[80];
cout<<"Enter a string: ";
gets(a);
for(int i=0;a[i]!='\0';i++);
for(int j=i;j>=0;j--)
cout<<a[j];
getch();
}
This C++ Program to display a string reversed.