Question
Hello, I need help with my C++ assignment. I really do not get the 1st exercise I think that she is asking how many bytes
Hello, I need help with my C++ assignment. I really do not get the 1st exercise I think that she is asking how many bytes each name has.
Exercise A: (PC#9: Cyborg Data Type Sizes) You have been given a job as programmer on a Cybrog supercomputer. In order to accomplish some calculations, you need to know many bytes the following data types use: char int float double You do not have any manuals, so you can't look this information up. Write a C++ program that will determine the amount of memory used by these types and display the information on the screen.
Exercise B Note: In this exercise, I am trying to comprehend all the concepts of the chapter-2.
Declare these variables in your code.
int firstNum = 10; double secNum = 2.5; bool value = true;
- The numbers in the third line and fourth line, you are using the command sizeof().
- All these calculations, your program does (12.4, 7.5, 25, 4)
- Use mathematical operators ( +, -, *, /) to do the calculations. There isn't any manual calculation.
- You must match your output with mine (Don't worry about the extra things that I wrote).
- There is a line gap between the lines, your output must have these line gap.
Exercise C: (PC#5: Average of values)
To get the average of series of values, you add the values up and then divide the sum by the number of values. Write a program that stores the following values in five different variables: 28, 32, 37, 24, and 33. The program should first calculate the sum of these five variables and store the result in a separate variable named sum. Then the program should divide the sum variable by 5 to get the average. Display the average to the screen. Design your output anyway you want.
Tip: Use double data type for all variables in this program.
Exercise D: (Area Of Circle)
Write a program, that calculates the are of the circle with radius 5.50 (data type is double). To calculate the area us the formula PI* radius*radius.
You must declare PI as Named Constant. (PI = 3.14159)
Exercise E: (PC#11: Distance per Tank of Gas)
A car with 20-gallon gas tank averages 23.5 miles per gallon when driven in town and 28.9 miles per gallon when driven on the highway. Write a program that calculates and displays the distance the car can travel on one tank of gas when driven in town and when driven on the highway.
Hint: The following formula can be used to calculate the distance.
Distance = Number of Gallons * Average Miles per Gallon
Design your output anyway you want. Please pay attention to the fact, someone else is using your code and that person should be able to understand what he/she is doing. Keep your output user friendly.
Exercise F:
Write a program that displays this output. Between 2 lines there is one line gap, your output must have those gaps. There is single quote around the name, your output must have them (Refer to table 2-2, pg 35 about Common Escape Sequence. You must use \t for tab, do not use space bar for that).
Frist number is: 10 Size of the first number is:4 bytes. Size of the second number is 8 bytes. These are the calcualtions! Addition => 12.5 Subtraction => 7.5 Multiplication => 25 Division => 4 These numbers are calculated by your program Bool Value is: 1 ------List One------ Item Count Pencil 10 Pen Brush 14Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started