What will the following segment of code output if 11 is entered at the keyboard? int number; cin >> number; if (number > ; 0) cout << "C++"; else cout << "Soccer"; cout << " is "; cout << "fun" << endl; 1. C++ is fun 2. Soccer is fun 3. C++ 4. C++fun 5. Soccerfun
1 answer:
Answer:
1. C++ is fun
Explanation:
Writing the code more clear:
int number;
cin >> number;
if (number > 0)
cout << "C++";
else
cout << "Soccer";
cout << " is ";
cout << "fun" << endl;
On the IF line, the conditional expression is evaluated TRUE (11 > 0), so the string "C++" is printed.
Then, the ELSE sentence is not executed since the expression has been already evaluated as TRUE.
Notice there are no additional brackets, so only the line cout << "Soccer"; is considered inside the ELSE .
The two remaining lines are executed always.
The final result is:
C++ is fun
You might be interested in
Most network behavior analysis system sensors can be deployed in passive mode only, using the same connection methods as network based idpss. Idps works as a network or host based systems. Most Nba sensors can be deployed in passive mode only too. The Nba examines the network traffic.
Your answer is -B. Folder Is the best place to save it
Answer:
Explanation:
.....
...,....
Answer:
the variable used in a loop to control the number of timer is executed is called a interaction.
Explanation:
a particular way in which matter, fields, and atomic and subatomic particles affect one another
Answer:
Sep 24, 2016 · Que inventos importantes se crearon durante la edad del agua y el viento Recibe ahora mismo las respuestas que necesitas!
Explanation: