Question

(1) What are the advantages and disadvantages to using the Int data type rather than the...

(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.

Homework Answers

Answer #1

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!!!!!!!!!!!!!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1. Given the following multi-way if statement, provide a switch statement, using proper java syntax, that...
1. Given the following multi-way if statement, provide a switch statement, using proper java syntax, that will provide the same function. Char grade; String tstmsg; if (grade == ‘A’) {   tstmsg = “Excellent”; } else if (grade == ‘B’) {   tstmsg = “Good”; } else if (grade == ‘C’) {   tstmsg = “OK”; } else {   tstmsg = “Study More”; } 2.Write the following for statement as a while statement. for (k = 0; k < 3; k++) {   System.out.println...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
Edit question Psychology 251 ~. What are the advantages and disadvantages for children with visual and...
Edit question Psychology 251 ~. What are the advantages and disadvantages for children with visual and hearing impairments based on the age of initial occurrence? How does this affect your teaching strategy for the students? Briefly give examples. 2. Normally sighted children enter school with a great deal of knowledge about trees. How could a teacher help the young child who has been blind since birth (congenitally blind) develops the concept of trees? 3. How would you explain the sound...
JS, DOM, webapplication question 1.similarities between Javascript and python/Java/C? What differences? 2.thoughts on type coercion in...
JS, DOM, webapplication question 1.similarities between Javascript and python/Java/C? What differences? 2.thoughts on type coercion in Javascript? Do you see any benefits? Any drawbacks? 3.advantages using someElement.addEventListener("someEvent", someFunction) has over someElement.someEvent = someFunction ? 4. scalability, latency, and robustness (ability to handle failure, uncertainty, stress, etc.) as key concerns in designing and implementing web applications. Explain how you think various properties of the HTTP protocol (e.g., statelessness, headers, caching) relate to or address these key concerns. 5. a basic HTTP...
1. What type of qualitative research guides the researcher to work to produce knowledge within groups...
1. What type of qualitative research guides the researcher to work to produce knowledge within groups or communities that are vulnerable to the control of a dominant group or culture? a. Feminist research b. Case studies c. Participatory action research d. Historical research 2. Qualitative researchers maintain reflexive journals to identify their preconceived beliefs about the phenomenon under study. Which statement provides a tip for discovering this type of personal bias? a. Clarify your personal values and identify areas of...
QUESTION 1 A method of estimating bad debts that focuses on the balance sheet rather than...
QUESTION 1 A method of estimating bad debts that focuses on the balance sheet rather than the income statement is the allowance method based on a. direct write-off b. aging the trade receivable accounts c. credit sales d. specific accounts determined to be uncollectible QUESTION 2 In a business combination, goodwill is defined as the excess of cost over the a. fair value of assets acquired b. fair value of assets acquired less the liabilities assumed c. book value of...
this is the book name. Data Structures and Abstractions with Java 1) Description: The sample programs...
this is the book name. Data Structures and Abstractions with Java 1) Description: The sample programs in Chapter 1 of your textbook are not complete. They are used for illustration purpose only. The implementation of Listing 1-1 on page 39 is explained in Chapter 2. And, in order to see the result of using it, we will need the following set of files: i. BagInteface.java – the specification only. ii. ArrayBag.java – the implementation of BagInerface.java. iii. ArrayBagDemo.java – a...
The following article does a good job of breaking down the advantages/disadvantages of leasing vs. purchasing...
The following article does a good job of breaking down the advantages/disadvantages of leasing vs. purchasing vehicles: Title: Pros and Cons of Leasing vs. Buying a Vehicle Source: http://www.investopedia.com/articles/pf/05/042105.asp Buying a car can be overwhelming. In fact, the pleasure of getting a new car can be quickly clouded during the financing decision-making process and price negotiations. Besides price haggling, many car shoppers are plagued with the decision to leaseor buy. Which financing decision is right and why? This article will...
Experimental data: Length L0 of the cold rod (measured with a meter stick): 600 +/- 1...
Experimental data: Length L0 of the cold rod (measured with a meter stick): 600 +/- 1 mm Cross-sectional diameter d of the rod (measured with a caliper): 6.1 +/- 0.1 mm The change in length ∆L after the rod reached its final temperature: 1.04 +/- 0.01 mm The initial temperature of the rod (the room temperature): 22 +/- 1 ̊C The final temperature of the rod shown by the thermometer: 93 +/- 1 ̊C Linear thermal expansion coefficient calculation: 1)...
1. When constructing a confidence interval to estimate a population proportion, what affects the size of...
1. When constructing a confidence interval to estimate a population proportion, what affects the size of the margin of error? A. The sample size B. The sample proportion C. The confidence level D. All of the above affect the size of the margin of error E. None of the above affect the size of the margin of error 2. What percentage of couples meet through online dating apps? A survey of a random sample of couples finds that 12% say...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT