60 626
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #22655 in C++ for rodea embradura

Question #22655
create a program that will generate the following output:

Enter a Word: Data Structure
Output: erutcurtS ataD
Expert's answer
#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions