Question

4. Write a program that inputs 5 scores using a do while loop and asks a user whether to continue or not (yes or no il pre

C++
0 0
Add a comment Improve this question Transcribed image text
Answer #1

//IF YOU ARE SATISFIED WITH THE CODE, KINDLY LEAVE A LIKE, ELSE LEAVE A COMMENT

QUESTION 4>

#include <iostream>

using namespace std;

int main()

{

    int sum = 0;

    int input;

    int count = 0;

    string choice = "yes";

    do

    {

        cout << "\nEnter the number: ";

        cin >> input;

        sum += input;

        count += 1;

        if(count >= 5)

            break;

        cout << "Would you like to continue?(yes/no)";

        cin >> choice;

    } while (choice == "yes");

    cout << "\n\nAverage is " << (double)sum / count << endl

         << endl;

}

OUTPUT PREVIEW:

6 8 G+ Chegg43.cpp > main() 1 #include <iostream> 2 using namespace std; 3 int main() 4. { 5 int sum = %; int input; 7 int co

QUESTION 5>

#include <iostream>

using namespace std;

int main()

{

    int sum = 0;

    int input;

    int arr[5][2];

    for(int i = 0; i< 5; i++){

        cout<<"\nEnter the division number: ";

        cin>>arr[i][0];

        cout<<"Enter the quaterly earnings: ";

        cin>>arr[i][1];

        sum += arr[i][1];

    }

    cout << "\n\nTotal earnings " << sum << endl

         << endl;

}

OUTPUT:

G+ Chegg44.cpp > main() 1 #include <iostream> 2 using namespace std; 3 int main() 4 5 int sum = 0; 6 int input; int arr[5][2]

QUESTION 6>

#include <iostream>

using namespace std;

int main()

{   

    for (int i = 32; i >= 0; i-=4)

    {

        cout<<" "<<i;

        if(i!=0){

            cout<<",";

        }

    }

}

OUTPUT:

4 G+ Chegg45.cpp > main() 1 #include <iostream> using namespace std; int main() { for (int i = 32; i >= 0; i-=4) { cout<< «

Add a comment
Know the answer?
Add Answer to:
C++ 4. Write a program that inputs 5 scores using a do while loop and asks...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the nested loop in C++ to finish the program //test scores. //It asks the user...

    Using the nested loop in C++ to finish the program //test scores. //It asks the user for the // number of students and //the number of test scores //per student. // Calc. and display average score // for each TEST 2 4 6 7

  • In C programming Write a program that displays the appropriate prompt to input 5 scores. Once...

    In C programming Write a program that displays the appropriate prompt to input 5 scores. Once the user inputs the five integer values, your program calculates and prints the average. You do not need to declare five different variables, think of how you can get away with a single variable. The second part of this program will print A if the average of these 5 numbers is greater than or equal to 90 but less than 100, B if greater...

  • java program QUESTION 2: 1. Write a do-while loop that asks the user to select a...

    java program QUESTION 2: 1. Write a do-while loop that asks the user to select a task from the following menu to continue: 1. Option 1 2. Option 2 3. Option 3 4. Option 4 5. Exit Read the selection from the keyboard then write the switch statement: For option 1, display the message "Do the option 1" For option 2, display the message "Do the option 2" For option 3, display the message "Do the option 3" For option...

  • in c++ language 1.Re-write the following for loop statement by using a while loop statement: int...

    in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){                 sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() {    int score, highest;             //missing portion of the program             return 0;    } 1(c). Find the missing portion of the following code, so the...

  • Write a single program in java using only do/while loops for counters(do not use array pls)...

    Write a single program in java using only do/while loops for counters(do not use array pls) for the majority of the program and that asks a user to enter a integer and also asks if you have any more input (yes or no) after each input if yes cycle again, if not the program must do all the following 4 things at the end of the program once the user is finished inputting all inputs... a.The smallest and largest of...

  • Write a program that instantiates an array of integers named scores. Let the size of the...

    Write a program that instantiates an array of integers named scores. Let the size of the array be 10. The program then first invokes randomFill to fill the scores array with random numbers in the range of 0 -100. Once the array is filled with data, methods below are called such that the output resembles the expected output given. The program keeps prompting the user to see if they want to evaluate a new set of random data. Find below...

  • You are to write a program IN C++ that asks the user to enter an item's...

    You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...

  • In C++ Assignment 8 - Test Scores Be sure to read through Chapter 10 before starting this assignment. Your job is to write a program to process test scores for a class. Input Data You will input a tes...

    In C++ Assignment 8 - Test Scores Be sure to read through Chapter 10 before starting this assignment. Your job is to write a program to process test scores for a class. Input Data You will input a test grade (integer value) for each student in a class. Validation Tests are graded on a 100 point scale with a 5 point bonus question. So a valid grade should be 0 through 105, inclusive. Processing Your program should work for any...

  • (For Python program)   Write a program that fulfills the functionalities of a mathematical quiz with the...

    (For Python program)   Write a program that fulfills the functionalities of a mathematical quiz with the four basic arithmetic operations, i.e., addition, subtraction, multiplication and integer division. A sample partial output of the math quiz program is shown below. The user can select the type of math operations that he/she would like to proceed with. Once a choice (i.e., menu option index) is entered, the program generates a question and asks the user for an answer. A sample partial output...

  • In C++ Write a menu driven C++ program to read a file containing information for a list of Students, process the data, t...

    In C++ Write a menu driven C++ program to read a file containing information for a list of Students, process the data, then present a menu to the user, and at the end print a final report shown below. You may(should) use the structures you developed for the previous assignment to make it easier to complete this assignment, but it is not required. Required Menu Operations are: Read Students’ data from a file to update the list (refer to sample...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT