THANKS pamle answer sheet. r Question 48, write only the C++ code Using the foun
ID: 3553117 • Letter: T
Question
THANKS
pamle answer sheet. r Question 48, write only the C++ code Using the found below, write only the actual (c++)code program. Please note that two designs have been provided, reflecting the different styles for this the prologues). This question of the two instructors. Include all libraries and document all code (with the exception of This additional page is worth 20 For your writing convenience, you will use a separate page to write your code. includes a basic "she of a Use the vertical lines to line up your indentation Specification: write a program that will repeatedly ask the user for quiz grades in the range from 0 to 50. Any negative value will act as sentinel/flag. When the sentinel/flag is entered compute the average of the grades entered. The output would be in the styl The average of 12 grades was 43.42. Prof Lemmo's Design Constants None Begin Prompt user for grade Variables Display "Enter gradeExplanation / Answer
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int temp;
float average;
int count=0, total=0, grade;
cout << "Enter grade <0 - 50, or negative to quit> ";
cin >> grade;
while(grade >= 0){
total += grade;
count++;
cout << "Enter grade <0 - 50, or negative to quit> ";
cin >> grade;
}
average = (float)total/count;
printf("The average of %d grades was %0.2f ",count, average);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.