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
Given a integer, convert to String, using String Builder class. No error checking needed on input integer, However do read in th
Gennadij [26K]

Answer:

The program in Java will be:

// Java program to demonstrate working parseInt()  

public class GFG  

{  

   public static void main(String args[])  

   {  

       int decimalExample = Integer.parseInt("20");  

       int signedPositiveExample = Integer.parseInt("+20");  

       int signedNegativeExample = Integer.parseInt("-20");  

       int radixExample = Integer.parseInt("20",16);  

       int stringExample = Integer.parseInt("geeks",29);  

 

       // Uncomment the following code to check  

       // NumberFormatException  

 

       //   String invalidArguments = "";  

       //   int emptyString = Integer.parseInt(invalidArguments);  

       //   int outOfRangeOfInteger = Integer.parseInt("geeksforgeeks",29);  

       //   int domainOfNumberSystem = Integer.parseInt("geeks",28);  

 

       System.out.println(decimalExample);  

       System.out.println(signedPositiveExample);  

       System.out.println(signedNegativeExample);  

       System.out.println(radixExample);  

       System.out.println(stringExample);  

   }  

}

7 0
3 years ago
Water is constantly in motion.<br> True or false
motikmotik

Answer: true

Explanation: yes water is constantly in motion

7 0
2 years ago
What is the best free game designing program for windows
Nadusha1986 [10]
Python, Unity 3D, C++Notepad
8 0
3 years ago
Who is the father of computer​
r-ruslan [8.4K]

charles babbage is the father of computer's

3 0
3 years ago
Read 2 more answers
you'll be organizing the various databases in your organization, and have recommended hiring a/an?A. internet specialist B. comp
jek_recluse [69]
Either c or d, most probably D
7 0
3 years ago
Read 2 more answers
Other questions:
  • Ninety-two percent of the new information was stored on magnetic media, mostly in _____.
    11·1 answer
  • ________ is a password-cracking method wherein the attacker compares passwords to lists of common words.
    12·1 answer
  • You '' friend or ''like'' a page o your favorite social media page that advertises a
    10·1 answer
  • What are finger nails made of?-
    12·2 answers
  • HURRY
    8·1 answer
  • Which person would be the best fit for a career in the Information Technology field?
    6·2 answers
  • I wish we could visit Paris for the holidays into exclamatory​
    12·2 answers
  • The __________ algorithm takes the ciphertext and the secret key and produces the original plaintext
    11·1 answer
  • The percentage of typical calls that would reach a respondent eligible to participate in a project is called the
    9·1 answer
  • Henry wants to create a presentation for his clients. He wants to upload the presentation file directly to the Internet. Which p
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!