Code the following statements using combined assignment operators:
1. price1 is equal to price1 plus 5.
2. price2 is equal to price2 times 7.0
3. price3 is equal to price3 divided by 4.5
4. totalPrice is equal to totalPrice modulus 3
Hint: Things like an equal sign or multiply sign but initialize the variables. - ✔️✔️double
price1 = 3.45, price2 = 5.79, price3 = 15.64;
int totalPrice = 98;
//1.
price1 += 5;
//2.
price2 *= 7.0;
//3.
price3 /= 4.5;
//4.
totalPrice %= 3;
What does the following code output to the user?
int A = 10, B = 17, C = 2;
double D = 17.01;
bool boolValue = true;
if (A > B)
{
cout << "Good afternoon, sir." << endl;
if (A == C)
{
cout << "Fine weather today we're having." << endl;
}
}
else if (D < B)
{
cout << "It looks like it will rain later on." << endl;
}
else
{
cout << "Good morning." << endl;
, if (boolValue == true)
{
cout << "The sun's bright at this time." << endl;
}
else
{
cout << "We've got a lot of cloud cover now." << endl;
}
} - ✔️✔️//The code outputs:
//Good morning.
//The sun's bright at this time.
What does the following code ouput to the user?
int num1 = 10, num2 = 13, num3 = 10, square, quotient;
bool firstBool = true;
bool secondBool = false;
if (firstBool && num2 < num3)
{
cout << "Good day!" << endl;
if (firstBool && !(secondBool))
{
cout << "Fine weather this morning." << endl;
}
else
{
cout << "The weather's a bit muggy, isn't it?" << endl;
}
}
else if (!firstBool || !secondBool)
{
cout << "Hello!" << endl;
if (firstBool && (secondBool == false))
{
cout << "Top of the morning to you!" << endl;
}
if (num1 == num3)
{
cout << "The sun is shining bright today." << endl;
}
else
{
cout << "It's a bit chilly out, don't you think?" << endl;
}
}