(Data processing) a. Store the following data in a file, or use the numbers.dat file provided on this book’s Web site.
5 96 87 78 93 21 4 92 82 85 87 6 72 69 85 75 81 73
b. Write a C++
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
C++ for Engineers and Scientists
- (C ONLY) The program expects the name of an input file and an output file to be given by the user. If the user does not input any names, default file names should be used, such as input.txt and output.txt. The input files have lines which look like this: 3 Tester College; 1909 33001 The first number represents the rank; it is followed by the school name, year founded, and approximate number of students. Read the list of colleges into an array of structures. You may assume that the maximum size of a college name string is 64. The program should use either the insertion sort algorithm or the selection sort algorithm to sort the array in descending order by rank. Display any k consecutive schools requested by the user. For instance, if the user enters 12, the program displays the first 2 schools in a readable format of your choice. If the user enters 15, the program displays the first five schools, if the user enters 2 7, display 7 schools beginning with the one at index 1 (2 - 1), and so…arrow_forward(3) Create the final cpp file under Source files and name it 2D Imaging. Write a C++ program to replace the star or asterisk (*) character with any other character of your choice. You may choose to use that ascii code of one of the characters. You must write a 2-Dimenional loop to programmably replace the character. To do this you must list on paper the row and column pairs of the 2D array that stores the given character. You may see a pattern of number series. Use this pattern to write the loops. The image pattern draws a V shape on the 12rows-11column 2D Grid or board. { {' }; '}, '}, '}, '},arrow_forwardModified Programming ). (Count vowels and consonants, file input, nested-loops, switch statement) Assume that letters A, E, I, O and U are the vowels. Write a program that reads strings from a text file, one line at a time, using a while-loop. You do the following operations within each loop: • Read one line from the input file and store it in a string; Count the number of vowels and consonants (using either while-loop or for-loop) in the file string. The while-loop will terminate when the end-of-file is reached. After the loop is finished, the program displays the total number of vowels and consonants in the text file. [A text file, named “ass4_Q6_input.txt", is provided as your testing input file.]arrow_forward
- Prlda..arrow_forwardCan you give me the java code for the followingarrow_forwardQ1: A. Develop an M-file that input the n value in to a function and display the value of R as a R= 1² +2²+3² ............. n term result. B. Write Matlab code to keep asking for a number until you enter a negative number, using While loop Structure. C. Use a switch statement to rewrite the following code segment x = 1; a = 3; if(a == 1) x = x+5; elseif (a== 2) x = x+10; elseif (a == 3) x = x+16; else x = x+34; end disp(x);arrow_forward
- python help, fill in the "your response" parts Write function quoteByNum() that takes as input the name of a file (as a string) and an index i (as an integer). The file will contain quotes, one per line. The function should open the file, read the file, close the file, and return the i-th quote (i.e. the i-th line in the file), assuming that the quote numbering starts at 0. Test your solution on file Wilde_Quotes.txt.>>> quote("Wilde_Quotes.txt", 5)'At twilight, nature is not without loveliness, though perhaps its chief use is to illustrate quotations from the poets.\n'>>> quote("Wilde_Quotes.txt", 0)'A little sincerity is a dangerous thing, and a great deal of it is absolutely fatal.\n'>>> quote("Wilde_Quotes.txt", 23)'Patriotism is the virtue of the vicious. \n'>>> def quoteByNum(file, int1): your response (docstring) infile = open(file) # your response content = infile your…arrow_forwardQ2) Write a C++ program to read and write from the file, three numbers (No.1 ,No.2 and No.3) and calculate the max. value using function?arrow_forward.arrow_forward
- (python) Write a function startWith(File, Let) that takes a file name and a letter. Each line in the file contains 1 word. The function should store a new file with all the words that start with letter Let. Example: startWith (‘Test1-3.txt’, ‘A’) Source File: (Test1-3.txt) Output File: (Test1-3New.txt) Hi Airport Airport Apple Hello Apple Mangoarrow_forwardDO NOT WRITE MAIN! Only write the function. A 50% minimum deduction will be made if main is included. No libraries or comments should be specified. (OP4) Write a function to prompt the user for the filename, open the file, and verify that it opened. If the file does not open, an error message should be printed and the user re-prompted. The function should use the string passed in for the prompt string. The function should not return until the file is open. The function prototype: void openInputFile( ifstream &, string ); ifstream& - the stream to be opened. string - the prompt to be written out to the user. Use this string when prompting the user.arrow_forwardAnswer quickly as soon as possible Send the code in c++ formetarrow_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