Compiles, but turingscraft still wants something else

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>
using namespace std;

int main()
	
{
	int random;
	
	cout << "Input variable data: ";
	cin >> random ;
	cout << random << " " ; 
	cout << random * 2 << " " ;
	cout << random * random ;	
	
		
	return 0;
	
}
Last edited on
justin00 wrote:
Besides the numbers, nothing else should be written to standard output except for spaces separating the values .

Are you not outputting something else on line 9?
Try getting rid of the following line:

cout << "Input variable data: ";
This on the heels of a chapter that insists that input should always be preceded by an instruction line.
Topic archived. No new replies allowed.