1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
elena-s [515]
3 years ago
15

Use the variables k, d, and s so that they can read three different values from standard input--an integer, a double, and a stri

ng respectively. On one line, print these variables in reverse order with exactly one space in between each. On a second line, print them in the original order with one space in between them.
Computers and Technology
1 answer:
Nat2105 [25]3 years ago
7 0

Answer:

The c++ program to implement the given scenario is shown below.

#include <iostream>

using namespace std;

int main() {

   // variables declared as mentioned

   int k;

   double d;

   string s;

   cout << " Enter an integer value, a double value, a string value in the mentioned order " << endl;

   cin >> k >> d >> s;

   // variables printed in reverse order

   cout << " Reverse order " << endl;

   cout << s << " " << d << " " << k << endl;

   // variables printed in original order

   cout << " Original order " << endl;

   cout << k << " " << d << " " << s << endl;

   return 0;

}

OUTPUT

Enter an integer value, a double value, a string value in the mentioned order  

12 45.67 brainly

Reverse order  

brainly 45.67 12

Original order  

12 45.67 brainly

Explanation:

1. All the variables are declared as mentioned in the question.

int k;

   double d;

   string s;

2. The user is prompted to enter values for integer, double and string variables respectively. The input is accepted in the order mentioned above.

cin >> k >> d >> s;

3. The input is accepted in a single line since this is mentioned in the scenario that variables should be printed in the order in which they are read.

4. These variables are displayed to the standard output in reverse order – string, double, integer. The variables are displayed with exactly one space in between them.

cout << s << " " << d << " " << k << endl;

5. Then, variables are displayed in the original order – integer, double, string. The variables are displayed with exactly one space in between them.

cout << k << " " << d << " " << s << endl;

You might be interested in
Before a program written in c can be executed on a computer, what step is required to be done first?
sergejj [24]
It should be compiled. It won't work if it's not compiled.
6 0
3 years ago
PLEASE HURRY!!<br> Look at the image below!
never [62]
The answer would be 2&5 because this is correct
5 0
2 years ago
Read 2 more answers
What critical-thinking tool is being used when asking the question, Is this information specific enough?
Murljashka [212]
Precision, specificity is related to the accuracy of the information with respect to the subject at hand. Precision is the only answer that makes sense.
6 0
3 years ago
What does gps stand for ?
frutty [35]
GPS stands for Global Positioning System
3 0
3 years ago
Read 2 more answers
Which of the following is not a valid FICO Credit score?
kumpel [21]

Answer: C 475

Explanation:  These choices are A. 375, B. 276, and D. 575. so that wolde mean it would be C 475.

8 0
3 years ago
Read 2 more answers
Other questions:
  • April 107 90 29 31 66 0.344
    8·1 answer
  • A(n) _____ is the highest educational degree available at a community college. master bachelor associate specialist
    13·2 answers
  • Fill in the blank. Do not abbreviate.
    6·1 answer
  • An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the ci
    14·1 answer
  • Write a program that uses these bounds and bisection search (for more info check out the Wikipedia page on bisection search) to
    8·1 answer
  • Fatal error: Class 'Drush\Commands\DrushCommands' not found in /Users/amy/testsite/Sites/acquia dev desktop/fresh-install/module
    7·1 answer
  • Identify examples of loop structures using comments in your code. Be sure your examples address each of the following: i. Item-b
    6·1 answer
  • Write a Java program that prompts the user for an int n. You can assume that 1 ≤ n ≤ 9. Your program should use embedded for loo
    5·1 answer
  • The difrent between valid deductive argument and strong inductive argument? At least 2 example​
    6·1 answer
  • Name 3 things that you use daily that are considered computers?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!