View the step-by-step solution to:

Question

C++ programming

1. Write a program that reads a number and displays the square, cube, and fourth power. Use

the pow function only for the fourth power.

2. Write a program that prompts the user for two integers and then prints

• The sum

• The difference

• The product

• The average

3.Write a program that asks the user for the lengths of the sides of a rectangle and then prints

• The area and perimeter of the rectangle

• The length of the diagonal (use the Pythagorean theorem)

4. Your local charity has tasked you with writing a computer program that calculates the average of the donations made by 3 donors. The program should ask for the name of each donor, ask for the amount donated by each donor, and calculate the average. The output of the program should display the donor name, the amount donated for each donor. The program should finally output a message that shows the average donated amount. Example output:

Tyra 50

Nathaniel 30

Lillian 10

Average of these donations is: 30

First, describe your algorithm using pseudocode.

Translate the pseudocode into a C++ program. You must comment your program including comments at the top of the file that explains what the program does and comments for every line of code that explains what is happening for the line of code. Apply troubleshooting and testing strategies to ensure your code compiles, runs, and provides accurate results.

Submit 2 files:

Your Word document with your pseudocode.

Your .cpp file

Sign up to view the entire interaction

Top Answer

View the full answer
Programming question.txt

q1 ------------- // Example program #include <iostream> #include <string> #include <cmath> #include <sstream> int main() { int number; std::cout << "What is your...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online