Plz i need help with this C++ program Student Generated Code Assignments Option
ID: 640446 • Letter: P
Question
Plz i need help with this C++ program
Student Generated Code Assignments Option 1: Write a program that will read in 3 grades from the keyboard and will print the average (to 2 decimal places) of those grades to the screen. It should include good prompts and labeled output. Use the examples from the earlier labs to help you. You will want to begin with a design. The Lesson Set I Pm-lab Reading Assignment gave an introduction for a design similar to this problem. Notice in the sample run that the answer is stored in fixed point notation with two decimal points of precision. Sample run: Please input the first grade Please Input the second grade 98.3 Please Input the third grade The average of the three grades is 96.77Explanation / Answer
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double grade1, grade2, grade3, avg;
cout << "Please enter first grade" << endl;
cin >> grade1;
cout << "Please enter second grade" << endl;
cin >> grade2;
cout << "Please enter third grade" << endl;
cin >> grade3;
avg = (grade1 + grade2 + grade3) / 3;
cout << "The average of three grades is " << int(avg * 100) / 100.0;
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.