Declare k, d, and s so that they can store an integer , a real number, and a sma
ID: 3542497 • Letter: D
Question
Declare k, d, and s so that they can store an integer , a real number, and a small word (under 10 characters ).
Use these variables to first read in an integer , a real number, and a small word and print them out in reverse order (i.e., the word, the real, and then the integer ) all on the same line, separated by at least one space from each other.
Then, on a second line, print them out in the original order (the integer , the real, and the word), separated again by at least one space from each other.
Explanation / Answer
#include<iostream.h>
#include<conio.h>
void main()
{
int k;
float d;
char s[20];
cout<<"Enter an integer ";
cin>>k;
cout<<"enter a double value "
cin>>d;
cout<<"enter string ";
getchar(s);
cout<<"print reverse data ";
cout<<s<<d<k;
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.