87.8k views
0 votes
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 EXACTLY 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 EXACTLY one space from each other.

User Nids
by
4.9k points

1 Answer

2 votes

Answer:

int k;

double d;

char s[10];

cin >> k >> d >> s;

cout << s << " " << d << " " << k << "\\" << k << " " << d << " " << s;

Step-by-step explanation

First Step (declare K, d, s) so they can store a integer

int k;

double d;

char s[10];

Second Step (read in an integer, a real number and a small word)

cin >> k >> d >> s;

Third Step ( print them out )

cout << s << " " << d << " " << k << "\\" << k << " " << d << " " << s;

User Jony Adamit
by
5.3k points