MyProgrammingLab - For Gaddis: Starting Out with C++ From Control Structures through Objects
15th Edition
ISBN: 9780133780611
Author: Pearson
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 2.7, Problem 2.13CP
Program Plan Intro
Byte occupation for a data type:
In
- There are many data types available in programming language.
- The basic data types are,
- char.
- int.
- float.
- double.
- bool.
- The memory byte for “char” datatype is “1”.
- The memory byte for “integer” data type is “2”.
- The memory byte for “float” data type is “4”.
- The memory byte for “double” data type is “8”.
- The memory byte for “bool” data type is “1”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Let's assume the number 8 is stored in memory location 5. What's the difference between copying the contents of cell 5 into cell 6 and typing the value 5 into cell 6?
The only data types I can choose from are CHAR, VARCHAR, DATE, DECIMAL, INT, and SMALLINT. Thanks!
Which is correct with respect to the size of the data types?
a) char > int < float
b) int < char > float
c) char < int < float
d) char < int < double
Chapter 2 Solutions
MyProgrammingLab - For Gaddis: Starting Out with C++ From Control Structures through Objects
Ch. 2.1 - The following C++ program will not compile because...Ch. 2.3 - The following C++ program will not compile because...Ch. 2.3 - Study the following program and show what it will...Ch. 2.3 - Write a program that will display your name on the...Ch. 2.4 - Prob. 2.5CPCh. 2.4 - What will the following program display on the...Ch. 2.6 - Which of the following are illegal variable names,...Ch. 2.6 - Prob. 2.8CPCh. 2.6 - Prob. 2.9CPCh. 2.6 - Prob. 2.10CP
Ch. 2.7 - Prob. 2.11CPCh. 2.7 - Which of the following is a character literal? B BCh. 2.7 - Prob. 2.13CPCh. 2.7 - Write a program that has the following character...Ch. 2.7 - What is wrong with the following program...Ch. 2.7 - Prob. 2.16CPCh. 2.7 - Write a program that stores your name, address,...Ch. 2.11 - Prob. 2.18CPCh. 2.11 - Prob. 2.19CPCh. 2.11 - Prob. 2.20CPCh. 2.14 - Is the following assignment statement valid or...Ch. 2.14 - How would you consolidate the following...Ch. 2.14 - What is wrong with the following program? How...Ch. 2.14 - Prob. 2.24CPCh. 2.16 - Prob. 2.25CPCh. 2 - How many operands does each of the following types...Ch. 2 - How may the double variables temp, weight, and age...Ch. 2 - Prob. 3RQECh. 2 - Write assignment statements that perform the...Ch. 2 - Is the following comment written using single-line...Ch. 2 - Is the following comment written using single-line...Ch. 2 - Modify the following program so it prints two...Ch. 2 - What will the following programs print on the...Ch. 2 - Multiple Choice 9. Every complete statement ends...Ch. 2 - Prob. 10RQECh. 2 - Every C++ program must have a ________. A) cout...Ch. 2 - Preprocessor directives begin with ________. A) #...Ch. 2 - The following data 72 'A' Hello World" 2.8712 are...Ch. 2 - A group of statements, such as the contents of a...Ch. 2 - Which of the following are not valid assignment...Ch. 2 - Which of the following are not valid cout...Ch. 2 - Assume w = 5, x = 4, y = 8, and z = 2. What value...Ch. 2 - How would each of the following numbers be...Ch. 2 - The negation operator is ________. A) unary B)...Ch. 2 - A(n) ___________ is like a variable, but its value...Ch. 2 - Prob. 21RQECh. 2 - T F A variable must be defined before it can be...Ch. 2 - T F Variable names may begin with a number.Ch. 2 - T F Variable names may be up to 31 characters...Ch. 2 - T F A left brace in a C++ program should always be...Ch. 2 - T F You cannot initialize a named constant that is...Ch. 2 - Prob. 27RQECh. 2 - Convert the following pseudocode to C++ code. Be...Ch. 2 - There are a number of syntax errors in the...Ch. 2 - Sum of Two Numbers Write a program that stores the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Sales Tax Write a program that will compute the...Ch. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Average of Values To get the average of a series...Ch. 2 - Annual Pay Suppose an employee gets paid every two...Ch. 2 - Ocean Levels Assuming the oceans level is...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Cyborg Data Type Sizes You have been given a job...Ch. 2 - Miles per Gallon A car holds 15 gallons of...Ch. 2 - Distance per Tank of Gas A car with a 20-gallon...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Circuit Board Price An electronics company sells...Ch. 2 - Prob. 14PCCh. 2 - Triangle Pattern Write a program that displays the...Ch. 2 - Diamond Pattern Write a program that displays the...Ch. 2 - Stock Commission Kathryn bought 750 shares of...Ch. 2 - Energy Drink Consumption A soft drink company...
Knowledge Booster
Similar questions
- 1. 0Q. Write a program to find the sum of the first 1000 prime numbers?arrow_forwardThe Boolean data type, commonly referred to as Yes/No, is a binary data type that can only have two possible values. Please provide more context or information for me to rewrite the user's text to be academic.arrow_forwardWhich of the following takes less memory space?a. int b. long c. float D. byte to. doublearrow_forward
- Indicate which of the following two declarations are valid or invalid. If invalid, give reason. int primes = {2, 3, 4, 5, 7, 11}; float elapsedTimes[] = {11.47, 12.04, 11.72, 13.88};arrow_forwardWhich of the following functions DOES NOT have a memory leak? Select one: void func(string word) { int* ptr = new int[2]; ptr[0] = word.size(); delete ptr; } void func(string word) { int* ptr = new int; *ptr = word.size(); } void func(string word) { int* ptr = NULL; int len = word.size(); ptr = &len; cout << "Length of " << word << " is " << *len << endl; }arrow_forwardIn which memory segments are the variables in the following code located? Explain your reasoning. int i = 0; void func(char *str) { char *ptr = malloc(sizeof(int)); char buf[1024]; int j; static int y; }arrow_forward
- Correct answer will be Upvoted else downvoted. Thank you! Which of the following is a valid floating-point literal?a) f287.333b) F287.333c) 287.e2d) 287.3.e2arrow_forwardYour answer could not be processed because it contains errors: line 23: invalid preprocessing directive #Promptarrow_forwardIs the division statement in the following code an example of integer division or floating-point division? What value will be stored in portion? double portion; portion = 70 / 3;arrow_forward
- Can you tell me the error in this code and how to fix that error? #include<stdio.h> void main() { struct { int number; char c[20]; int on_hand; } part1= {100, "Disk drive"}, part2= {570,"Floppy",5}, part3= {.number=78, .c="Hard Drive", .on_hand=67}, part4= {"Disk Drive", 100}, part5={.c="Hard Drive",.number=100, .on_hand=80}, part6; printf("part5.number=%d\n",part5.number); printf("part1.onhand=%d\n",part1.on_hand); part1.on_hand*part4.number; part1.on_hand++; struct { char c[20]; int number; char gender; int on_hand; } part89; part6=part1; printf("part6.number=%d",part6.number); part89= part1; struct part { int n; char c[20]; int on_hand; }; struct part part50, part45; struct part x,y,z; }arrow_forwardPlease fill in the blanks for C /* Print full name*/ #include<stdio.h> #include<stdbool.h> __1__ scan_print_name(__2__ size, __3__ name[size]); // function header int main() { int len; bool isDone = false; //default to false since it's not done without running char enter; //this is to avoid the first getChar captures the enter from length //Get name and redo them over and over till the name length is big enough // isDone is our flag to know if we need to run again. // isDone == true means we are done, and vice versa do { printf("\nEnter your full name's length."); printf("Make sure to count spaces and null character:"); scanf("%d%c", &len, &enter); char fullName[len]; isDone = scan_print_name(len, fullName); }while(!isDone);…arrow_forwardWhat is the output of the following program segment? int count = 5;while (--count > 0)cout << 2 * count << " ";cout << endl;arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr