C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
10th Edition
ISBN: 9780134448848
Author: Paul Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter E, Problem E.9E
Program Plan Intro
- Include the required header files.
- Declare function prototype which is used in the program.
- Define the “main()” function.
- Declare the variable n to assign number of elements.
- Declare the int array named arr[n] with size n.
- run a loop from 0 to n to take values from keyboard
- Call the function PRINTARRAY() to print the values in the array.
- Function PRINTARRAY(int arr[], int) Function has two arguments one is array argument which receives the array passed by the calling function second is to receive the number of elements in the array.
Runs a for loop from 0 to n (total number of elements).
Prints the array elements.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Computer Science
Let f2(x) be the smallest number n such that x < n2. Write a program in S that computes f2. If you use any macro, you have to provide the corresponding macro expansion.
Write a function that receives a two-dimensional array, prints out the data by row along with the sum of the row values. Each value should be printed separated by a space. After the last element in the row has been printed, the sum should be printed on the same line, followed by a newline.
Write a C++ program to prompt user for a file name and read the data containing information for a course, store and process the data, display a menu and allow user to pick an operation to perform continue till user decides to quit, and at the end print a final report shown below.
Details:
Set the array size to 50, but there could be less or more students info in the file, manage the list according the actual data elements.
Develop a struct named Student to represent a student’s data: (Minimum the following data members need to be included), more is OK.
Name (First, Last)
ID
Scores (An array to store test scores)
Quiz (score for 1 quiz)
Grade
Average
Write all the necessary utility functions to process the Student struct (readStudent, printStudent, processStudent,…)
You may update and use the struct definition and utility functions developed for Programming assignment 5 or develop a new one.
Develop any additional functions to process a list of students as necessary (Such as…
Chapter E Solutions
C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a C++ program to prompt user for a file name and read the data containing information for a course, store and process the data, display a menu and allow user to pick an operation to perform continue till user decides to quit, and at the end print a final report shown below. Details: Set the array size to 50, but there could be less or more students info in the file, manage the list according the actual data elements. Develop a struct named Student to represent a student’s data: (Minimum the following data members need to be included), more is OK. Name (First, Last) ID Scores (An array to store test scores) Quiz (score for 1 quiz) Grade Average Write all the necessary utility functions to process the Student struct (readStudent, printStudent, processStudent,…) You may update and use the struct definition and utility functions developed for Programming assignment 5 or develop a new one. Develop any additional functions to process a list of students as necessary (Such as…arrow_forwardWrite a C++ program to prompt user for a file name and read the data containing information for a course, store and process the data, display a menu and allow user to pick an operation to perform continue till user decides to quit, and at the end print a final report shown below. Details: Set the array size to 50, but there could be less or more students info in the file, manage the list according the actual data elements. Develop a struct named Student to represent a student’s data: (Minimum the following data members need to be included), more is OK. Name (First, Last) ID Scores (An array to store test scores) Quiz (score for 1 quiz) Grade Average Write all the necessary utility functions to process the Student struct (readStudent, printStudent, processStudent,…) You may update and use the struct definition and utility functions developed for Programming assignment 5 or develop a new one. Develop any additional functions to process a list of students as necessary (Such as…arrow_forwardWrite a program to use parallel arrays to save User ID and Password. Ask the user to enter the user ID and Passwords for 3 users Save the above information in two parallel arrays (using the same index for each user) After the input is completed, ask the user to enter any user ID and then ask the password for that ID. Confirm if the User ID and password match, if not ask the password Note - In java please thank youarrow_forward
- A python function opens file data.csv, reads the data from the file and spits the data into three columns, x, y and z. The data is then printed out. Function: f = open("data.csv ", "r") print('x\ty\tz'.format()) for row in f: temp = row.split(',') for cell in temp: print(cell,end='\t') print() data.csv contains: 1.2,2.1,1.1 2.3,3.2,0.6 0.7,1.9,0.1 1.8,2.5,0.3 4.6,2.7,0.9arrow_forwardWrite a program that records high-score data for a fictitious game. The program will ask the user to enter the number of scores, create two dynamic arrays sized accordingly, ask the user to enter the indicated number of names and scores, and then print the names and scores sorted by score in descending order. The output from your program should look exactly like this (given the same input): How many scores will you enter?: 4 Enter the name for score #1: Suzy Enter the score for score #1: 600 Enter the name for score #2: Kim Enter the score for score #2: 9900 Enter the name for score #3: Armando Enter the score for score #3: 8000 Enter the name for score #4: Tim Enter the score for score #4: 514 Top Scorers: Kim: 9900 Armando: 8000 Suzy: 600 Tim: 514arrow_forwardWrite a program that records high-score data for a fictitious game. The program will ask the user to enter the number of scores, create two dynamic arrays sized accordingly, ask the user to enter the indicated number of names and scores, and then print the names and scores sorted by score in descending order. The output from your program should look exactly like this (given the same input): How many scores will you enter?: 4 Enter the name for score #1: Suzy Enter the score for score #1: 600 Enter the name for score #2: Kim Enter the score for score #2: 9900 Enter the name for score #3: Armando Enter the score for score #3: 8000 Enter the name for score #4: Tim Enter the score for score #4: 514 Top Scorers: Kim: 9900 Armando: 8000 Suzy: 600 Tim: 514 Additional Requirements The data must be stored in two dynamic arrays: an array of strings named names, and an array of ints named scores. These arrays must be declared and allocated using "new" in the main function. The user input of the…arrow_forward
- Write a program that records high-score data for a fictitious game. The program will ask the user to enter the number of scores, create two dynamic arrays sized accordingly, ask the user to enter the indicated number of names and scores, and then print the names and scores sorted by score in descending order. The output from your program should look exactly like this (given the same input): How many scores will you enter?: 4 Enter the name for score #1: Suzy Enter the score for score #1: 600 Enter the name for score #2: Kim Enter the score for score #2: 9900 Enter the name for score #3: Armando Enter the score for score #3: 8000 Enter the name for score #4: Tim Enter the score for score #4: 514 Top Scorers: Kim: 9900 Armando: 8000 Suzy: 600 Tim: 514 Additional Requirements The data must be stored in two dynamic arrays: an array of strings named names, and an array of ints named scores. These arrays must be declared and allocated using "new" in the main function. The user input of the…arrow_forwardComputer Science Write a program that uses 3 command line arguments to search a list of float numbers in a file and prints out the result of whether the number was found or not on the console. Also, it prints the array in the reverse order (not sorted but reverse order of how the numbers were read in). The first argument is the name of the input file which has the numbers to be searched, the second is an integer specifying how many numbers are in the input file and the third argument is the float number being searched for. Use dynamic memory allocation for the array and use a function (that returns a boolean value) to do the searching. Also make sure in the beginning of your program, that the program will execute only if exactly three arguments (other than executable name itself) are specified. at the command line.arrow_forwardwrite a program that reads up to 100 numbers from a file. As you read thenumbers, insert them into an array in ascending order.Specifications:1A. Write a function called addToArrayAsc.i. It should take three arguments -a. sortedArray[ ] : sorted array that should be able to hold at most 100 floats.b. numElements : the number of elements inserted so far.c. newValue : the incoming float value to be inserted into the sortedArray.ii. The addToArrayAsc function should return a count of the elements inserted so far(i.e. the current size of the array).The function header will appear as follows: OBJECTIVES 1. Read-in command line arguments2. Read a file3. Loop through an array4. Split a string5. Create an array of struct types6. Read and Write to a file int addToArrayAsc(float sortedArray[], int numElements, float newValue);arrow_forward
- Write a program to use parallel arrays to save User ID and Password. Ask the user to enter the user ID and Passwords for 3 users Save the above information in two parallel arrays (using the same index for each user) After the input is completed, ask the user to enter any user ID and then ask the password for that ID. Confirm if the User ID and password match, if not ask the passwordarrow_forwardWrite a C++ program that requests the user to enter 10 floating-point values. The first 5values are stored in the array A, while the next 5 values are stored in array B. Then, calculate C = A + B, where C is an array. Write the result in a file in the following format:Ci = Ai + Biarrow_forwardWhich of the following is a difference between vectors and array? The ability to change size dynamically Ration access to any element using the [] operator Efficient direct access to any element Stored in contiguous blocks of memoryarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License