(1) What are the advantages and disadvantages to using the Int data type rather than the bool data type to manipulate Boolean expressions? Why do students think the int data type is still used for Boolean expressions?
(2) Discuss how C++ provides two-way selection through the if....else statement. Explain the syntax of this statement. Also, explain how the bool data type is used in C++ to manipulate Boolean expressions.
QUESTION#1
ADVANTAGES:
Boolean is more limited than Integer.
By using unsigned int bugs can be exposed more easily
DISADVANTAGES:
It take more memory while bool take less memory in the ram as compared to the int
Easy to make choice by using bool data type while in int it is not like this
Question#2
if else statment
int time = 25;
if (time < 14) {
cout << "Good day.";
} else {
cout << "Good evening.";
}
// Outputs "Good evening."
PLEASE GIVE A THUMBS UP!!!!!!!!!!!!!
Get Answers For Free
Most questions answered within 1 hours.