Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3.5.2: Bool in branching statements. Write an if-else statement to describe an o

ID: 3666177 • Letter: 3

Question

3.5.2: Bool in branching statements. Write an if-else statement to describe an object. Print "Balloon" if isBalloon is true and isRed is false. Print "Red balloon" if isBalloon and isRed are both true. Print "Not a balloon" otherwise. End with newline.

(please answer in C++)

Write an if-else statement to describe an object. Print "Balloon" if isBalloon is true and isRed is false. Print "Red balloon" if isBalloon and isRed are both true. Print "Not a balloon" otherwise. End with newline. 1 #include 2 using namespace std; 4 int maino int mainO C 5 bool isRed=false; 7 8 Your solution goes here bool isBalloon = false; 1 return0

Explanation / Answer

#include<iostream>
using namespace std;

int main(){

bool isRed = false;
bool isBallon = false;

if(isBallon && !isRed)
        cout<<"Ballon"<<endl;
else if(isBallon && isRed)
        cout<<"Red ballon"<<endl;
else
        cout<<"Not a ballon"<<endl;

system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote