Write a
For example, for the input
−12 3 −12 4 1 1 −12 1 −1 1 2 3 4 2 3 −12 |
the output should be
N Count 4 2 3 3 2 2 1 4 −1 1 −12 4 |
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Electric Circuits. (11th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Modern Database Management
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- 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_forwardWrite a C++ program that asks a user to input 10 numbers. The numbers are stored in the array if it is not Odd and not already available. After creating the array, it asks the user to enter a number and deletes it from the arrayarrow_forwardUsing C++ Write a program that reads 10,000 words into an array of strings; the "List of 10,000 Random Words" file is on Moodle. The program will then read a second file (the list of "Search Words" is also on Moodle) that contains an undetermined number of words and search the first array for each word. The program will then report the number of words in the second list that were found on the first list. Do not use an array for the second file, process the words as they are read. Note that some of these "words" might have spaces; handle your input accordingly.arrow_forward
- Write a function that reads all the numbers from a file into an array. The file is already open and there is no bad data in the file. The data is one number per line and the file has an unknown number of lines of data. Assume that the array is large enough to hold all the data. The data should be stored in the array starting at the first element. Prototype void readData( ifstream& iFile, double numbers[ ], int& count); iFile - already open ifstream numbers[ ] - array to store data count - the number of values read and must be set by the function before returning.arrow_forwardUse C++ In a student file, there are names and scores. Find the max score and print out the names of the students with the max score. • You must get a filename as standard input. See two sample outputs on the next page. • The number of students in the file is at most 50. • You need to make two arrays (see the next page). 1. Create a string array with size 50. The array will store the names of the students. 2. Create an integer array with a size of 50. The array will store the scores of the students.arrow_forwardIn C++ please Write a program to simulate a pick-5 lottery game. Your program should generate and store 5 distinct numbers between 1 and 9 (inclusive) into an array. The program prompts the user to enter five distinct between 1 and 9 and stores the number into another array. The program then compares and determines whether the two arrays are identical. If the two arrays are identical, then the user wins the game; otherwise the program outputs the number of matching digits and their position in the array. Your program must contain a function that randomly generates the pick-5 lottery numbers. Also, in your program, include the function sequential search to determine if a lottery number generated has already been generated.arrow_forward
- A c++ program is needed to store and manage the records of all the students in a particular class. Each record should consist of the student’s name, ID consists of program code and student number, 5 coursework marks, and an examination mark.Write a c++ program that creates an array of struct to keep 10 student’s records. Your program should allow user to input data and store them into a file. The program then reads from the file to calculate the final mark for every student, and display the student’s name, id, and final mark in a tabular format. The final mark is calculated as 60% from the average coursework marks (not including the lowest) and 40% from the examination mark. The output is also stored into a file.Use functions to calculate the final mark for a student and to display all the students’ information. Identify the suitable parameters and return value for each function.arrow_forwardIn C program language, You are to read 10 numbers from a data file into an array named List. Create another 10 element array named Reverse that is to contain the same items as List but in reverse order. For example, the first element in List will be placed in the last position of Reverse, the second element in List will be placed in the second-to-last position in Reverse, etc. After Reverse has been created, output the contents of both arrays.arrow_forwardWrite a C++ program that simulates online shopping. Declare a variable cart to be an empty Array. The program should have a loop that continues as long as the user wants to shop. Each time through the loop read in the name, price, and quantity of the item the user wants to add to the cart. After adding an item to the cart, the cart contents should be printed. After the loop print a "Please pay ...” message with the total price of the items in the cart.arrow_forward
- Given a file of unsorted words with mixed case: read the entries in the file and sort those words lexicographically. The program (in c++) should then prompt the user for an index, and display the word at that index. Since you must store the entire list in an array, you will need to know the length. The "List of 1000 Mixed Case Words" contains 1000 words. You are guaranteed that the words in the array are unique, so you don't have to worry about the order of, say, "bat" and "Bat."arrow_forwardIn statistics the mode of a set of values is the value that occurs most often. Write a program that determines how many pieces of pie most people eat in a year. Set up an integer array that can hold responses from 30 people. For each person, enter the number of pieces they say they eat in a year. Then write a function that finds the mode of these 30 values. This will be the number of pie slices eaten by the most people. The function that finds and returns the mode should accept two arguments, an array of integers, and a value indicating how many elements are in the array.arrow_forwardIn C++ Create an array of 100 random numbers between 1 and 1000. Ask the user for a number. Search the array and check if the users number is in the array.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT