Write a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average test score by printing it to the terminal using the following format: Your average test score is: X

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

C++

Write a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average test score by printing it to the terminal using the following format:

Your average test score is: X

(Assume that the test scores are decimal numbers.)

!!! 3/
注
</>
Instructions
Write a program that prompts the user
to enter five test scores and then prints
the average test score. Indicate the
average test score by printing it to the
terminal using the following format:
Your average test score is: X
(Assume that the test scores are
decimal numbers.)
Grading
14
15
16
17
10 11 12 13
18
19
20
21
8
9
Nos p
2
4
5 int
6 {
7
3 us:
do
do
CO
ci
COU
cir
cou
cin
cout
cinx
cout
cin>
avg=
cout<
Transcribed Image Text:!!! 3/ 注 </> Instructions Write a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average test score by printing it to the terminal using the following format: Your average test score is: X (Assume that the test scores are decimal numbers.) Grading 14 15 16 17 10 11 12 13 18 19 20 21 8 9 Nos p 2 4 5 int 6 { 7 3 us: do do CO ci COU cir cou cin cout cinx cout cin> avg= cout<
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Didn't necessarily come out correct when i ran it

main.cpp
CO
1 #include <iostream>
2
3 using namespace std;
4
5 int main()
6 {
7 float sum-0;//initalize the decimal sum to 0
float number;//declare number variabke
float average;//declare the average variable
cout<<"Enter five test scores:";// asking user to
five tests scores
8
10
11
12
13
14
4649823738198eISBN=9781337631952&id=1504488916&snapshotld=2... A
16
17
18
+
for(int i_0; <5; ++){ //interate loop 5 times
cin>>number;//input a number
sum+=number;//getting
sum of all numbers
}
average=sum/5;//calculating average of 5
cout<<"Your average test score is:" <<average;//p
the average of 5 numbers
}
7
99+
a
> Terminal
-
✩
Q Search this course
X
I
Not syncin
+
ore')' token
r(int i_0; <5;++) {//interat
e loop 5 times
main.cpp:13:3: error: 'sum'
was not declared in this s
cope
erate loop 5 times
ANN
i X
sum+=number;//getting su
m of all numbers
A
main.cpp:11:11: warning: un
used variable 'i_0' [-Wunus
ed-variable]
for(int i_0; <5; ++){//int
ing average of 5
main.cpp:15:11: error: 'sum
was not declared in this
scope
average=sum/5;//calculat
sandbox $ ./a.out
bash: ./a.out: No such file
or directory
sandbox $
1
Transcribed Image Text:main.cpp CO 1 #include <iostream> 2 3 using namespace std; 4 5 int main() 6 { 7 float sum-0;//initalize the decimal sum to 0 float number;//declare number variabke float average;//declare the average variable cout<<"Enter five test scores:";// asking user to five tests scores 8 10 11 12 13 14 4649823738198eISBN=9781337631952&id=1504488916&snapshotld=2... A 16 17 18 + for(int i_0; <5; ++){ //interate loop 5 times cin>>number;//input a number sum+=number;//getting sum of all numbers } average=sum/5;//calculating average of 5 cout<<"Your average test score is:" <<average;//p the average of 5 numbers } 7 99+ a > Terminal - ✩ Q Search this course X I Not syncin + ore')' token r(int i_0; <5;++) {//interat e loop 5 times main.cpp:13:3: error: 'sum' was not declared in this s cope erate loop 5 times ANN i X sum+=number;//getting su m of all numbers A main.cpp:11:11: warning: un used variable 'i_0' [-Wunus ed-variable] for(int i_0; <5; ++){//int ing average of 5 main.cpp:15:11: error: 'sum was not declared in this scope average=sum/5;//calculat sandbox $ ./a.out bash: ./a.out: No such file or directory sandbox $ 1
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education