readFile() This function should accept the filestream opened in main. The filestream should then be used to loop through the file, inserting each book's information into a book that is then inserted into an array of books. You will likely want to use getline() and string type casting (stoi, stof) here, as cin will stop reading at whitespace. Return the number of lines read from the file. This function should *not* open the filestream.
Q: How do the four most essential lessons learned from the development of MINIX relate to the current…
A: MINIX, a Unix-like operating system, has played a significant role in the history of operating…
Q: Describe the steps you would take to make the Boyer-Moore string search algorithm in order to do a…
A: Boyer-Moore Doing a String Lookup:The search for strings or patterns is a significant challenge in…
Q: This chapter explains three sequences of state transitions during TCP connection teardown. There is…
A: The teardown sequence refers to the series of steps or state transitions that occur during the…
Q: In your own words, describe software engineering. What are the three main components of software…
A: A subfield of computer discipline known as "Software Engineering" methodically applies engineering…
Q: How does a data breach effect cloud security? What are some possible countermeasures?
A: According to the question a records breach exposes personal, sensitive, or blanketed facts to an…
Q: Write a client that takes integers M, N, and T as input and runs the following experiment T times:…
A: Programme to a client that receives the integers M, N, and T as input and runs the following test T…
Q: Can you please draw this in the Flowgorithm app please?
A: Flowgorithm is a graphical programming language and integrated development environment (IDE) used…
Q: Email experience? How many clicks before my email goes from A to B? Note your comprehension. Why is…
A: Email has become a crucial communication tool in both personal and professional settings.…
Q: The C struct, Exercise In C++: The programming assignment at the end of this module will involve a…
A: Declare a struct named Square with a single attribute, "side", representing the length of one of its…
Q: Examine the performance of Ubuntu relative to other Linux distributions by comparing it to other…
A: Regarding Linux distributions, Ubuntu is quite well-liked due on the way to its user-friendly…
Q: The following ideas can be used to sum up operating system microkernel architecture: How is this…
A: The microkernel architecture is a design wherever only the most indispensable military, such as…
Q: Sets A and B are both subsets of U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and defined as follows. A = {r…
A: Give three set U , A and BIn which set A and B is derived or defined from set U . Need to find out…
Q: Explain from a developer's perspective why deep access is preferable to superficial access, rather…
A: The separation between surface and deep access pertains to the level at which a Developer interacts…
Q: What is the process through which a virtual network interface card (VNIC) obtains a MAC address?
A: Defined the process through which a virtual network interface card(vNIC) obtains a MAC address
Q: In this section, we'll explain what "software maintenance" means and how it differs from corrective,…
A: Software maintenance refers to the process of modifying and updating software applications after…
Q: Find out if there are any limits on the IT infrastructure that need to be beaten in order for the…
A: List the difficulties to developing a new service's IT infrastructure; is cloud computing a…
Q: such that a preorder traversal of T yields the elements of Tin
A: The answer is
Q: In C++ please follow the instructions Write two code blocks -- one code block to declare a bag and…
A: Write two code blocks -- one code block to declare a bag and its companion type-tracking array (both…
Q: Compilers have trouble with designs like VLIW and superscalar. Which building is more difficult?…
A: The Very Long Instruction Word (VLIW) and Superscalar are different architectures Utilized in…
Q: could you provide a flowgorithm chart so I can see the specific variables declared and assigned
A: Flowgorithm is a graphical programming language and integrated development environment (IDE) used…
Q: How can you anticipate and prepare for the plethora of potential cyber security threats when…
A: The cyber threat countryside is rapidly altering. In the face of these intimidation, anticipate and…
Q: Let S be the universal set, where: S = {1, 2, 3,..., 18, 19, 20} Let sets A and B be subsets of S,…
A: S = {1, 2, 3,..., 18, 19, 20}set A = {2, 3, 4, 9, 10, 19, 20}set B = {1, 3, 4, 5, 6, 10, 11, 12, 14,…
Q: Your data warehouse team may be considering a prototype. Learn data warehousing strategies to…
A: A data warehouse is a company’s system for long-term storage of data generated over the course of…
Q: What is the purpose of functions in the first place?
A: => A programming language is a formal language designed to communicate instructions to a…
Q: software engineering in your own words. What are the three primary components of software…
A: Software engineering, in essence, is the disciplined and systematic application of engineering…
Q: What basic software engineering ideas are missing? Explain?
A: Software engineering is a discipline that focuses on the systematic and disciplined approach to the…
Q: 1. What is Failover-Clustering and why do you think it is so widely used?
A: What is Failover-Clustering and why do you think it is so widely used?
Q: Provide me with the Matlab code to swap the second and third rows of the matrix given below, m=987…
A: Step-1: StartStep-2: Declare variable m and assign [9 8 7; 6 5 4; 3 2 1]Step-3: Declare variable…
Q: What's the difference between a thread running in user mode and one running in kernel mode? Is there…
A: ThreadThread is the lightweight process that can be managed independently by the scheduler. It…
Q: Explain the functioning of a SEM by drawing a sketch and giving captions for it. (10)
A: Scanning Electron Microscope - SEM stands for Scanning Electron Microscope. It is a powerful imaging…
Q: 4) Simplify the Boolean expression to a minimum number of literals: a'bc+abc' + abc+a'bc'
A: Boolean expression: A logical statement that results in a Boolean value, either True or False, is a…
Q: How can you aid in preventing internal and external threats?
A: Threats can be broadly defined as potential events, circumstances, or actions that can harm or…
Q: Why do people use packet sniffing software, and what are the advantages?
A: People use packet sniffing software for various reasons, primarily to analyze network traffic and…
Q: Write a program that scans all directories in a UNIX file system and finds and locates all i-nodes…
A: Here is the Python program that scans all directories in a UNIX file system and finds and locates…
Q: A single data structure works well for all different purposes - The - Fabe
A: Different purposes require different data structures to achieve optimal performance and efficiency.…
Q: Write a TST client that reads in text from standard input and calculates the number of unique…
A: The provided question asks for a Ternary Search Tree (TST) client implementation that reads text…
Q: Discuss the between different data types available in C++
A: Data types in C++ play a crucial role in programming as they determine the type of data that…
Q: How can you aid in preventing internal and external threats?
A: A threat is any suspicious or harmful action that has the potential to harm sensitive data, personal…
Q: 1C. Consider the grammar E → TE' E' → +TE' E T→FT' T'→ *FT' & F→ (E) | digit For the given…
A: According to the information given:-We have to define the mentioned grammar with the expression to…
Q: Can software engineering's primary objective be condensed? What are you referring to, to be more…
A: Software engineering's primary objective can be condensed into the effective and effective…
Q: write down the microinstructions to implement the instruction MOV R0, [R1], moving the contents of…
A: write down the microinstructions to implement the instruction MOV R0, [R1], moving the contents of…
Q: 1. Consider the following P = {P1, P2, P3, P4, P5} R = {R1, R2, R3, R4} E = {P3 R1, P2R2, R4→P4, R2…
A: We have to draw resource allocation graph and it is given in next step.
Q: Compare and contrast the pros and cons of using MATLAB alone versus the symbolic math toolset to…
A: MATLAB (Matrix Laboratory) is a high-performance language for technical computing, combining…
Q: Consider the grammar E-TE' E' → + TE' | E T→ FT' T' → *FT' | E F→ (E) | digit For the given…
A: According to the information given:-We have to define the mentioned grammar with the expression to…
Q: Use examples from the real world to show how useful dynamic programming is.
A: The dynamic Programming (DP) technique is a strong tool in computer discipline for Optimizing…
Q: this module will involve a struct named Square with exactly one attribute representing the length of…
A: A structure is a user-defined datatype used to group several different datatype variables into a…
Q: Several fundamental aspects of software engineering are occasionally disregarded. Explain?
A: Software engineering is a complex and dynamic field that involves designing, developing, testing,…
Q: What is the most distinguishing characteristic between laptop and desktop operating systems? What…
A: The operating System lies in the category of system software. It basically manages all the resources…
Q: You have learned about different ways to test black boxes, such as stress testing and volume…
A: Testing refers to the process of evaluating a system, application, or software to identify any…
Q: LCD in the sphere of information technology refers to a liquid crystal display. What does this…
A: LCD stands for "Liquid Crystal Display." It is a technology used for displaying visual information…
In C++, how is the readfile function written for this program?
Step by step
Solved in 3 steps with 1 images
- 1.In a loop, fill an array for up to 50 even numbers and a set for up to 50 odd numbers. Use the merge() algorithm to merge these containers into a vector. Display the vector contents to show that all went well. 2. Write a program that copies a source file of integers to a destination file, using stream iterators. The user should supply both source and destination filenames to the program. You can use a while loop approach and a list container with integer data type. Within the loop, read each integer value from the input iterator and add the value to the list container by using push_back() function, then increment the input iterator.Finally, use an output iterator to write the list to the destination fileRead Data Write a function that reads in data from a file using the prototype below. The function can define and open the file, read the names and marks into the arrays and keep track of how many names there are in numElts, and then closes the file. The list of names and marks can be found at the end of the lab and copied into a text file. void getNames(string names[], int marks[], int& numElts); Display Data Write a function to display the contents of names and marks using the prototype given below. void displayData(const string names[], const int marks[], int numElts); Linear Search Write the searchList function given the prototype below so that it searches for a given name. The functions returns and int which is the index of the name found. The main program will decide if -1 is returned then it will say name is not found otherwise it will write out the name and the mark for that name. int linearSearch(const string list[], int numElts, string value);…write a function called fillArrayFromFilethat will read numbers from a file that contains one double per line into an array(up to the size of the array) and then returns the number of doubles successfully readfrom the file. You may assume that the file contains valid doubles
- void Pokedex::wakeupProfessorJimi(std::string) − populates the dynamic array of Entries with data from a valid file path, the function should open the file and use the add (Pokemon*, int) function to insert a Pok ́emon into the correct position in the dynamic array of Entries. Once the position is determined, the Pok ́emon should be inserted into the corresponding position in the list of Pok ́emon belonging to the Entries object. i aready have a pokemon class with enum for types, move class and move class setup and working it's just this one part. here is the text file 1,Bulbasaur,45,49,[Grass,Poison],Fire,Water,[[tackle,40,40,100],[vine whip,45,45,100],[growl,10,10,100]] 2,Ivysaur,60,63,[Grass,Poison],Fire,Water,[[leech seed,45,45,90],[razor leaf,55,55,95],[growl,10,10,100]] 3,Venusaur,80,83,[Grass,Poison],Fire,Water,[[tackle,40,40,100],[leech seed,45,45,90],[razor leaf,55,55,95],[growl,10,10,100]] 4,Charmander,39,43,[Fire],Water,Fire,[[growl,10,10,100],[fire fang,65,65,95]]…The objective of this question is to generate and read files that contain a list of random numbers. Write a function that generates a file with following parameters: def fillFile(fileSize, fileName): The function should be called to generate files in the following sizes: fileSizes = [1000, 5000, 10000, 20000, 30000, 40000, 50000] The generated files can have names file1000, file 5000, file 10000, file20000, fi130000, file40000, file 50000. You can use random.randint(0.fileSize+1000) to generate a random number. Write another function that reads numbers inside of a file and returns a list. def readFile(fileName): The returned list contains the numbers stored in the file. At each call of fillFile and readFile, record the times before and after the function call as in following example (import time): start = time.time() fillFile(file Size, "file" + str(fileSize)) finish time.time() runTime = finish - start Record the run times of functions into a file named "fileStats.txt". The…def olympics_report(filename): """ Read and process the content of the text file named `filename` to produce a string with given formatting requirements. For each line in the file produce a string that has the following format: <name> is from <country> and competes in <sport> where <name>, <country>, and <sport> are strings found in the line of the file. :param filename: string :return: list of strings """ here is the text Arvo Ossian Aaltonen,M,34,Finland,Swimming,NA Juhamatti Tapio Aaltonen,M,28,Finland,Ice Hockey,Bronze
- C++ Programming: How would you write a function that takes a filename and an array of struct time, opens a file, reads each line in the file as the number of days, converts this to a struct time and stores this is in an array? Here is my code so far (p.s. the function i need help with is called void readData): #include<iostream>#include<string>#include<fstream>#include<cstdlib>#include<vector> using namespace std; struct time{// private:int years, months, days;//public: time(){}time(int days){}}; time getYearsMonthsDays(int days){time x;x.years = days/450;days = days%450;x.months = days/30;x.days = days%30;return x;} int getTotalDays(time x){int totalDays;totalDays = x.years*450 + x.months*30 + x.days;return totalDays;} void openofile(string ofilename,ofstream &fout){fout.open(ofilename.c_str());if(!fout){cout << "Error opening output file..." << endl;exit(1);}} void openifile(string ifilename,ifstream…Array/File FunctionsWrite a function named arrayToFile. The function should accept three arguments:the name of a file, a pointer to an int array, and the size of the array. The functionshould open the specified file in binary mode, write the contents of the array to the file,and then close the file.Write another function named fileToArray. This function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. Thefunction should open the specified file in binary mode, read its contents into the array,and then close the file.Write a complete program that demonstrates these functions by using the arrayToFilefunction to write an array to a file, and then using the fileToArray function to readthe data from the same file. After the data are read from the file into the array, displaythe array’s contents on the screen.Please help me write the following function (please see the attached photos for context of the problem): find_treasure(start_map_num): Takes an integer between 0 and 9 as input. Loads the corresponding map file, and starts following the trail (at position 0, 0 of that file) as described above. Continues following the trail through other map files as needed. Places an 'X' at the conclusion of the trail and saves the updated treasure map to a new file with 'new_' prepended to the current map filename. Returns a tuple of the row and column index where the 'X' was placed in that file.
- C++: You will create a header file with implementation that performs the task. Together with the header and implementation, you create a test program whose main function demonstrates that your functions work as they should. Two files, A and B which they are sorted. The files contain Numbers. Based on the files, create a third file let calles it C . that file C is going to contain all the elements in sorted order from both files A and B. This algorithm is called a merge..please code in pythonredact_file: This function takes a string filename. It writes a new file that has the same contentsas the argument, except that all of the phone numbers are redacted. Assume that the filename has onlyone period in it. The new filename is the same as the original with '_redacted' added before theperiod. For instance, if the input filename were 'myfile.txt', the output filename would be'myfile_redacted.txt'. Make sure you close your output file.The first hard task in this function is to make the output filename from the input filename that waspassed in. You can break it into two pieces by splitting on the dot or by using the index method andslicing. Then put it back together again using string concatenation.We are also working with files in this one. To open a file with a filename stored in the variable fname,in read mode use the open function as such: fp = open(fname). You will need to open the outputfile in write mode: open(fname, 'w'). Then you can traverse the…Case Problems - 1- In Chapter 8, you modified the EventDemo program for Carly’s Catering to accept and display data for an array of three Event objects. Now, modify the program to use an array of eight Event objects. Prompt the user to choose an option to sort Events in ascending order by event number, number of guests, or event type. Display the sorted list, and continue to prompt the user for sorting options until the user enters a sentinel value. Save the file as EventDemo.java.