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

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning