What will the value of the solution variable be after the code segment below has been run.
bool solution;
int number3 = 9, number7 = 29;
solution = number3 == number7;
#include<iostream>
using namespace std;
int main()
{
bool solution;
int number3 = 9, number7 = 29;
//Priority of operation "==" higher than "=" therefore
//number3 == number7 is false(0) and solution is false(0)
solution = number3 == number7;
cout << "Solution is " <<boolalpha<< solution;
}
Comments
Leave a comment