Answer to Question #22655 in C++ for rodea embradura
create a program that will generate the following output:
Enter a Word: Data Structure
Output: erutcurtS ataD
1
2013-01-23T08:52:42-0500
#include<iostream>
using namespace std;
void rev(char *,char []);
void main()
{
char a[30];
char *ptr;
cout<<"Enter a word: ";
cin>>a;
ptr=a;
rev(ptr,a);
system("PAUSE");
}
void rev(char *ptr,char a[])
{
int k,c,i;
char b[30];
k=strlen(a);
c=k-1;
cout<<"Output: ";
for(i=c;i>=0;i--)
{
b[i]=*ptr;
ptr++;
}
b[k]='\0';
cout<<b<<endl;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment