40.4k views
3 votes
C++ Question: what is in the blanks?

code:
int x = 24;
int y;
y = _-12;
cout<<_<<endl;

User Franza
by
9.0k points

1 Answer

3 votes

You didn't specify what the program should output, so there are many possibilities that result in a working program. It *looks* like this was intended:

int x = 24;

int y;

y = x-12;

cout<<y<<endl;

and it will display 12.

User Longday
by
8.3k points