Concept explainers
Consider two parallel arrays of the same size, one containing strings and the second containing integers. Write C++ statements to output the information in the two arrays as a table of names and numbers. The first column of the table will contain the names left-justified in a field of 20, and the second column will contain the integers right-justified in a field of 10. Here is an example of the data when the size of the array is 2.
const int SIZE = 2;
string names[SIZE] = {"Catherine", "Bill"};
int numbers[SIZE] = {12, 2005};
Trending nowThis is a popular solution!
Chapter 13 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with Python (3rd Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Absolute Java (6th Edition)
Starting Out With Visual Basic (8th Edition)
Starting out with Visual C# (4th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- use c++ to write a program that manages a list of up to 10 players and their high scores in the computer's memory. Use two arrays to manage the list. One array should store the player's name and the other array should store the player's high score. Use the index of the arrays to correlate the name with the score. In Chapters 10 and 11, you will learn a different way to organize related data by putting them into a struct or class. Your program should support the following features: a. Add a new player and score. If it is one of the top 10 scores then add it to the list of scores. The same name and score can appear multiple times. For example, if Bill played 3 times and scored 100, 100, and 99, and Bob played once and scored 50, then the top scores would be Bill 100, Bill 100, Bill 99, Bob 50. b. Print the top 10 names and scores to the screen sorted by score with the highest score first. c. Allow the user to enter a player name and output that player's highest score if it is on the top…arrow_forwardCreate a program in C Language that calculates a student's overall grade based on their assignments, quizzes, and exams. Create three separate arrays of `double` which will store 5 assignments, 3 quizzes, and 2 exams, respectively. The program should prompt the user to enter the grades for each group on one line (see example). The program should then compute the average of each individual group and then weight that group based on the value given for the corresponding weight. In the example run below, the average assignment score is first calculated and then multiplied by the given assignment weight. The final grade is calculated as the sum of all weighted groups and should be printed to 2 decimal places. Submit your code as grades.c Other Requirements Do not hard code any values. Use preprocessor directives or `const` globals for array sizes. Your code must use consistent formatting and spacing. Points will be taken off for inconsistent or sloppy code. Example Run Enter 5 assignment…arrow_forwardC ++ Qi Write a program to ask the user to record students’ ratings between (0 — 10) for 20 students into a “responses” array, then distribute those ratings into a “frequency” array, after that print them.arrow_forward
- Write a program in C as follows:- Create an array of integers named “toy” that has 120 rows and 4 columns.- The program should repeatedly display the following menu:A or a to add a toy to the bagV or v to calculate and display the total value of the toysW or w to calculate and display the total weight of the toysD or d to delete a toy from the arrayM or m to calculate and display the number of small toysN or n to calculate and display the number of medium toysL or l to calculate and display the number of large toysX or x to start filling a new bagP or p to exit program - Santa’s bag can hold 30 large toys or 60 medium toys or 120 small toys or any combination ofsizes that satisfy this requirement (ex: 29 large + 1 medium + 2 small would be max capacity).Also, the total weight of toys cannot exceed 620 Kgs. All values are entered in centimeters andgrams. (Hint: the return values of the size function should help you in calculating the bagcapacity.)The…arrow_forwardWrite a program in C as follows:- Create an array of integers named “toy” that has 120 rows and 4 columns.- The program should repeatedly display the following menu:A or a to add a toy to the bagV or v to calculate and display the total value of the toysW or w to calculate and display the total weight of the toysD or d to delete a toy from the arrayM or m to calculate and display the number of small toysN or n to calculate and display the number of medium toysL or l to calculate and display the number of large toysX or x to start filling a new bagP or p to exit programThe following functions need to be created and used in the program:- Void wipe(int cat[][4], int n);- Void populate(int cat[][4], int n);- Int size(int L, int W, int H);- Int check_capacity(int cat[][4], int n, int tsize, int tweight);- Int rm_toy(int cat[][4], int n, int toynum);- Int weight(int cat[][4], int n);- Int value(int cat[][4], int n);- Int small(int cat[][4], int n);- Int medium(int cat[][4], int n);- Int…arrow_forwardHello can someone help in C + + language thanksarrow_forward
- Using C++ Input a number into an array of characters. Check to see if all of the characters in the array are numeric. If they are not all numeric output (invalid input). If they are all numeric convert the characters to there integer form. Once in the integer form add 25 to the integer and print it out. Example run:Input a number-> 12A3(Invalid input)Input a number->125Your number plus 25 is150arrow_forward1. Write a program (C++) and algorithm that will calculate the average of test scores. It will ask the user for number of students and the number of test scores per student. 2. Create a program (C++) and algorithm that uses an array to store the results from a poll of 25 people. Each person was asked to estimate the amount of time, in minutes, that he or she spends on Facebook each day. The program should allow the user to enter a specific number of minutes and then display the number of people spending more than that length of time.arrow_forwardPrograming in C Write a program that calculates the average grade of a class. 1. You should ask the user how many students you have (you will use this number to set up the length of your array of decimals). 2. Once you have your array, you will have to ask the user for all the grades (there should only be one grade per student). Using a while loop. 3. While you are scanning the grades, you should check if the inputted grade is in the range 0.0 to 10.0 (inclusive). If the grade is not in this range, you should display a message to the user and assign 0.0 to the grade. 4. Once your array is populated with all student's grades, print out the values of the array, so that the user knows these values were saved correctly (use a while loop as well). 5. After this calculate the average (add up all grades and divide by the number of students). Hint: You will need a loop to do so; please use a while loop as well. Example: How many students are in your class? 8 Please input the grades: 8.5 9.8…arrow_forward
- Instructions Write a program in C++ that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions: Function getData: This function reads and stores data in the two-dimensional array. Function averageHigh: This function calculates and returns the average high temperature for the year. Function averageLow: This function calculates and returns the average low temperature for the year. Function indexHighTemp: This function returns the index of the highest high temperature in the array. Function indexLowTemp: This function returns the index of the lowest low temperature in the array. These functions must all have the appropriate parameters. An example of the program is shown below: Enter high temperature for each month 60 68 72 72 73 76 80 81 75 72 67 66 Enter low temperature for…arrow_forwardThe range of a set of values is the difference between the highest value and the lowest value in the set. Write a C/C++ program that prompts the user to enter N integer values and stores it in an array. Calculate and display the range of the values, as well as the largest and smallest values in the set. TIP: you can declare an array of size N by declaring the array after the user enters a value for N!arrow_forwardPlease use C++ Write a program that should ask the user to input 12 elements (whole/decimal| numbers) inside the array, which can either be positive or negative, in ascending order. Sample: Input: 0.23 -0.45 0.16 0.78 0.39 -0.11 0.81 -0.23 0.29 0.47 -0.09 0.14 Output: -0.45 -0.23-0.16-0.11-0.09 0.14 0.23 0.29 0.39 0.47 0.78 0.81arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education