I have written a code snippet program for the following question, and it compiles, and executes just as the directions ask, but apparently it isn't formatted like the teacher wants. It just keeps saying to write out the integer values according to the question. What exactly is it asking me to do that I am not doing?
Question: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 .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
usingnamespace std;
int main()
{
int random;
cout << "Input variable data: ";
cin >> random ;
cout << random << " " ;
cout << random * 2 << " " ;
cout << random * random ;
return 0;
}