Question: c++ PROBLEM 2 Use the following program shell for PROBLEMS 2 through 5. // Program Numbers sends numbers to the output stream in // specified
c++
PROBLEM 2
Use the following program shell for PROBLEMS 2 through 5.
// Program Numbers sends numbers to the output stream in // specified formats. #include#include using namespace std; int main () { cout << fixed << showpoint; return 0; }
Write a program to print the following numbers right-justified in a column on the screen. Make the values named constants.
1066 1492 512 1 -23
When you are finished, copy and paste your output to the end of your source code as a comment. Re-compile this commented code to make sure that your have not introduced any new errors.
Finally, copy your code/output and paste it into the box below.
PROBLEM 3
First, modify your program to prompt for the five (5) numbers.
Next, add two additional statements to your program. Calculate the floating-point result from dividing the sum of the first two values by the sum of the last three values and store it in answer. The second statement should write the contents of answer on the screen to four decimal places. (Do not forget to declare answer.)
When you are finished, copy and paste your output to the end of your source code as a comment. Re-compile this commented code to make sure that your have not introduced any new errors.
Finally, copy your code/output and paste it into the box below.
PROBLEM 4
Finally, modify your program use three (3) functions.
(1) add the heading function you wrote in PROBLEM 1 to your program. Of course, call the function from main.
(2) Write and call a value-returning function to calculate the floating-point result from dividing the sum of the first two values by the sum of the last three values and store it in answer.
The third void function should write the contents of answer on the screen to four decimal places. (Do not forget to declare answer in main.
Use the following prototypes in your program
void heading(); // function prototypes float divide_sum(int, int, int, int, int); void display_answer(float);
When you are finished, copy and paste your output to the end of your source code as a comment. Re-compile this commented code to make sure that your have not introduced any new errors.
Finally, copy your code/output and paste it into the box below.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
