Question
Create a program in the C++ language that: 1. Has a main() 2. includes the proper header and namespace declarations 3. Given an int variable
Create a program in the C++ language that: 1. Has a main()
2. includes the proper header and namespace declarations
3. Given an int variable name days that contains a number of days: a. Write an expression that gives the number of whole weeks corresponding to days. For example, if days contains 23, then the number of whole weeks is 3. b. Write an expression that gives the number of days REMAINING after taking the whole weeks out of the value in days. For example, if days contains 3, then the number of days remaining after 3 whole weeks is 2.
4. Given variables called dollars, quarters, dimes, nickels and pennies, write an expression that computes (adds) the total amount of the money represented in all the variables in pennies, For example, if dollar = 1 and quarters = 2, the total amount of money would be 150 (in pennies). The result should be an integer value representing the number of pennies in the total. Output the value.
5. Given the same variables as in 4 above (text exercise 3), compute the total but store it in a floating-point variable so that the integral part is dollars and the fractional part is cents.
6. Write an output statement that outputs the floating-point value in 5 above in eight spaces on the line, with a leading dollar sign ($) and two digits of decimal precision.
7. Create a string variable myString. Assign the value "This is my string". Write the statement that accesses the third character in string variable myString. Store the third character in a char variable, name of your choice. Output the value of the character variable.
8. Write the statement that changes the char variable defined above to lowercase. Output the value. 9. Write the statement that changes the char variable defined above to uppercase. Output the value.
Step 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