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++ MPL
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)
- using C++ In this exercise you would be using a text input file to store a number of students first and last names, and each students scores in test1, test2, midterm, final and homeworks. Now, you get all the stored in relevant arrays. Write a function that will accept all the scores and compute the average score for each student. You can pass only one student’s information at a time while calling the function. Write another function for the grade computation. Display your results with last name, first name, average score and grade for each student. Display should be on screen as well as in an output file.arrow_forwarduse 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_forwardplease help me with this. use only c++ code and nothing else. this topic is sorting arraysarrow_forward
- Create 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_forwardData Structure Ask the user to enter the size of an array. Create an integer array if the given sizeand fill it with random numbers. Print the array. Then take another number from theuser and search that number in the array. If the value is found, print the indices (pluralof index) where the value was found. Also print how many times the value was found.Solve the problem in c++.arrow_forwardWRITE C++ PROGRAM: Typhoon Casualties. Write a program using arrays to enter the following data: names of victims of typhoon Odette, age, and condition (A – alive, D – deceased, I – injured and M – missing). The size of your arrays should match the estimated number of persons in that particular barangay. Enter the name of barangay and the estimated total number of persons residing in that barangay during the typhoon. Display the following after the data entry according to their names – name (alphabetical order), condition and the count of person(s) alive, deceased, injured and missing and then get their percentage from the total population. Earthquake Incident Name of Barangay: _____________ Estimated number of residents:________ Name:____ Age:__ Condition (A,D,I or M):___ More Entry (Y/N)? Y Name:____ Age:____ Condition (A,D,I or M):___ : : Name:____ Age:____ Condition (A,D,I or M):___ More Entry (Y/N)? N List of Victims/Casualties Name Age Condition _____…arrow_forward
- C ++ 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_forwardUse C++ In part 1 you will be creating a quiz grading program. You will compare the student's answers with the correct answers, and determine passed or not. The program will make use of two parallel arrays. Each array must be able to support up to 30 characters (so you have two arrays of char or unsigned char values, each one with 30 elements). Your program will need to read in the student answer input file name from cin. It will also need to read in the correct answer file name from cin. You should use the >> operator to read from cin and not get or getline. Using get or getline will be more difficult and will require that you filter out white-space characters in your program. The contents of the student input file should be read into one char array. The file will contain up to 30 characters, each character on a separate line of the file. The first line in the input file will contain the students answer to the first question, and so on for up to 30 questions. The answers are A,…arrow_forwardlanguage is c++arrow_forward
- Please write in carrow_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 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_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