Question

im trying to make a program that will use a while loop to repeatedly ask a...

im trying to make a program that will use a while loop to repeatedly ask a user for a test score. Use a counter to exit the loop when the user has entered 10 test scores. The loop is to figure out the total of all the scores and the highest score. it must use a while loop please explain problems in code

the bottom code is my work done but does not work.

#include <iostream>

using namespace std;

int main() {

int test_score;

int high_score;

int counter = 0;

int target = 10;

while (counter < target){

cout << "Please enter you test score: ";

cin >> test_score;

counter += 1;

}

high_score = test_score[0];

for(int counter=0;counter<10;counter++){

if(test_score[] > high_score){

high_score = test_score[];

}

average = total_score/10;

cout << "The total score is:"<< total_score << endl;

cout << "The highest score is:" << high_score << endl;

cout << "The average is: " << average << endl;

}

Homework Answers

Answer #1

Note: Please like the answer. Thank you. Have a nice day.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Do While loop on C++ I need to program a do while loop in which the...
Do While loop on C++ I need to program a do while loop in which the user have to choose between option A,a, B,b or C,c. I need a do while loop that if other letter (different from options is choose) the loop print a cout saying "Invalid selection. Plese, enter the selection again.   I have one, but isn't working well int main() { char option; do { cout<<"Please choose one of the following options: "<<endl<<endl; cout<<"Option A - Julian...
Please write variables and program plan (pseudocode) of the C++ programming below: #include <iostream> #include <cmath>...
Please write variables and program plan (pseudocode) of the C++ programming below: #include <iostream> #include <cmath> using namespace std; void divisors(int num); int main () {    char repeat;    int num;       while (repeat !='n')    {        cout << "Enter a number: ";        cin >> num;        divisors(num);        cout << "Continue? (y or n): ";        cin >> repeat;    }    return 0; } void divisors(int num) {   ...
Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow...
Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space. Example output for userNum = 40: 20 10 5 2 1 ..... my code: #include <iostream> using namespace std; int main() { int userNum; userNum = 40; /* Your solution goes here */ while (userNum != 1){ userNum = userNum/2; cout << userNum << " ";   } cout << endl; return 0; } ........ but as a result i...
C++ please Write code to implement the Karatsuba multiplication algorithm in the file linked in Assignment...
C++ please Write code to implement the Karatsuba multiplication algorithm in the file linked in Assignment 2 (karatsuba.cpp) in Canvas (please do not rename file or use cout/cin statements in your solution). As a reminder, the algorithm uses recursion to produce the results, so make sure you implement it as a recursive function. Please develop your code in small The test program (karatsuba_test.cpp) is also given. PLEASE DO NOT MODIFY THE TEST FILE. KARATSUBA.CPP /* Karatsuba multiplication */ #include <iostream>...
How do I make this code not include negative numbers in the total or average if...
How do I make this code not include negative numbers in the total or average if they are entered? (C++) For example, if you enter 4, 2, and -2, the average should not factor in the -2 and would be equal to 3. I want the code to factor in positive numbers only. ----- #include using namespace std; int main() {    int x, total = 0, count = 0;       cout << "Type in first value ";   ...
There are 7 syntax errors and 3 semantic errors in the following code segment. Please mark...
There are 7 syntax errors and 3 semantic errors in the following code segment. Please mark them in the code and explain the reason briefly in place. #include<iostream> using namespace std; int main() { cout<<”Please input the radius (in integer): ”>>endl; int 1var = 10, var=20; double area = 40; cin<< var; //get an input of the radius and store in var float continue; float const pi = 2.64; pi += 0.5; do { cout<<”The radius is ”<<”var”<<endl; //print the...
Using a for Loop visual c++ Summary In this lab the completed program should print the...
Using a for Loop visual c++ Summary In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop. Instructions Write a for loop that uses the loop control variable to take on the values 0 through 10. In the body of the loop, multiply the value of the loop control variable by 2 and...
C++ program that Create a struct called car that has the following data members (variables): -...
C++ program that Create a struct called car that has the following data members (variables): - Color //color of the car - Model //model name of the car - Year //year the car was made - isElectric //whether the car is electric (true) or not (false) - topSpeed //top speed of the car, can be a decimal. code i have done struct not working properly. #include <iostream> using namespace std; struct Car { string color; string model_number; int year_model; bool...
1) Create a flowchart for the program below and Trace the program below with input of...
1) Create a flowchart for the program below and Trace the program below with input of 3 and then again with input of 5. #include <iostream> using namespace std; int Fall(int x, int m) { int Xm = 1, i=x; while(i>=x-m+1) { Xm = Xm*i; i=i-1; } return Xm; } int Delta(int x, int m) { int ans = 0; ans = Fall(x+1,m); ans = ans - Fall(x,m); return ans; } void main() { int x = 0, m =...
C++ PROGRAMMING Hi! I have to make a program that adds fractions and simplifies them. I...
C++ PROGRAMMING Hi! I have to make a program that adds fractions and simplifies them. I feel like I know how to write that. What I'm having trouble with is implementing two files the professer gave us. I would appreicate any help in understanding their purpose as in if Im supposed to take information from those files or give it information. Thank you! I have attatched the homework instructions and the two files given. Implementation The main program, called calculator.cpp...