Write a complete program that
declares an integer variable,
reads a value from the keyboard into that variable, and
writes to standard output the variable's value, twice the value, and the square of the value, separated by spaces.

Besides the numbers, nothing else should be written to standard output except for spaces separating the values.


Instructor's notes: Note:
They aren't expecting the system("pause"); statement in this program.
Normally we would want to precede our input statement(s) with output statements that tell the user of the program what the program expects them to do, but they don't want that here, so just write the input statement.
Normally we would always want to identify values that our program outputs, but in this case they aren't expecting any kind of words to be printed; they just want 3 numbers output with a space in between.

Respuesta :

ijeggs

Answer:

#include <iostream>

using namespace std;

int main()

{

   int num;

   cin>>num;

   cout<<num<<" "<<2*num<<" "<<num*num<<endl;

   return 0;

}

Explanation:

The code snippet above written in C++ programming language meets all the requirements of the question as specified in the instructors note.

Importantly is the use multiple C++'s cout (<<) operators to display all the output seperated by spaces on the same line.