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
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Degarmo's Materials And Processes In Manufacturing
SURVEY OF OPERATING SYSTEMS
Concepts Of Programming Languages
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- Q1 Write a C++ program that declares three arrays, Mark1, Mark2, Result. and carries out the following: 1. Allow the user to fill mark1 and mark2 with 5 integer elements. 2. Find the average of each two corresponding elements of the two arrays mark1 and mark2 then compare the average with 60. If the average is greater than or equal to 60 then fill the corresponding element of the third array with the character (P), Otherwise, file the corresponding element with the character (F). Mark1 70 50 66 90 Mark2 60 30 70 80 60 Result 40 LLarrow_forward1.Write a c++ program that identifies the shortest and longest word stored in an array of maximum size 100. It should then display the words together with their respective lengths and location in the array. The program should also display the average word length in the array. If there are multiple shortest and longest word, the first ones are selected. 2.Write a C++program that records information of cars in an array. Each car details include its model, year registered and plate number. The program should allow the user to perform the following tasks : a) Add car details into the array. If the array is full, the program should notify the user. b) Remove any car details from the array by searching a specific car. c) List down number of cars registered each year, provide that the registered year existed in the array.arrow_forwardc++ 6. Write a program which will prompt the user to enter an array of 12 characters. The program should then print the array, and then print the array again, but this time as a 4 colums by 3 rows array.arrow_forward
- 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_forwardWrite a C++ program that reads 6 real numbers from the user (negative and positive numbers) into an array, then it does the following:a. Find the sum and average of positive numbers of the array and display them. b. Count negative numbers of the array and display it.c. Find the minimum value of the array and display it.d. Find the index of the minimum value of the array and display it.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_forward
- please help me with this. use only c++ code and nothing else. this topic is sorting arraysarrow_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_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
- Use 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_forwardPlease complete this program in C++ Please enusre that there is plenty of comments. PLENTY even if unessessary. Please include screenshots of actual code, screenshots of output, and code in the browser so I can copy and paste. Thank you.arrow_forwardlanguage is c++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