Write the definition for a void function called toScreen. The function toScreen has one formal parameter called fileStream, which is of type ifstream. The precondition and postcondition for the function are as follows:
//Precondition: The stream fileStream has been connected
//to a file with a call to the member function open. The
//file contains a list of integers (and nothing else).
//Postcondition: The numbers in the file connected to
//fileStream have been written to the screen one per line.
//(This function does not dose the file.)
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Computer Science: An Overview (12th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Concepts of Programming Languages (11th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Modern Database Management (12th Edition)
- My Question starts here In the code linked Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer to a struct employee. This function should read the information from the file (reversing what writeEmpToFile does), create a new employee and fill in the data. If the FILE has no more info (is at end of file), this function should return NULL. This function must also ensure any employee actually created (not the NULL) is added to the array (as is done in createEmployee). Change main to load employees from a file if a command line argument is given to the program (using your readEmpFromFile function you just wrote). Question ends here To make it easier so that you do not have to go through the entire code I'm going to put writeEmpToFile function right here after the question but if you still need to look at the full code to get an understanding of what you are working with its linked at the bottom void writeEmpToFile(Employee *emp, FILE…arrow_forwardWrite a recursive function, displayFiles, that expects a pathname as an argument. The path name can be either the name of a file or the name of a directory. If the pathname refers to a file, its filepath is displayed, followed by its contents, like so: File name: file_path Lorem ipsum dolor sit amet, consectetur adipiscing elit... Otherwise, if the pathname refers to a directory, the function is applied to each name in the directory, like so: Directory name: directory_path File name: file_path1 Lorem ipsum dolor sit amet... File name: file_path2 Lorem ipsum dolor sit amet... ...arrow_forwardWrite a recursive function, displayFiles, that expects a pathname as an argument. The path name can be either the name of a file or the name of a directory. If the pathname refers to a file, its filepath is displayed, followed by its contents, like so: File name: file_path Lorem ipsum dolor sit amet, consectetur adipiscing elit... Otherwise, if the pathname refers to a directory, the function is applied to each name in the directory, like so: Directory name: directory_path File name: file_path1 Lorem ipsum dolor sit amet... File name: file_path2 Lorem ipsum dolor sit amet... ... # Put your code here import os #module used to interact with operating system def displayFiles(pathname): #recursive function that takes a pathname as argument if (os.path.isdir(pathname)): #checks if specified path (argument) is an existing directory #for item in os.listdir(pathname): for content in os.listdir(pathname): #gets the list of all files and directories in the directory and…arrow_forward
- The stream insertion operator << can be overloaded with an operator function that takesan istream reference and a reference to a user-defined type as arguments and returns anistream reference. T/Farrow_forwardConsider the Student class in the provided student.py file. Each student has a name, an id anda list of courses taken. A course is represented as a list with three items to indicate the coursename, semester taken and grade. For example, [‘comp1008’, ‘S24’, 76.3] represents this coursewith a final grade of 76.3. Complete all the functions in the provided a4.py file.arrow_forwardUse Python for this question: Write a standalone function partyVolume() that takes accepts one argument, a string containing the name of a file. The objective of the function is to determine the a Volume object that is the result of many people at a party turning the Volume up and down. More specifically: the first line of the file is a number that indicates the initial value of a Volume The remaining lines consist of a single character followed by a space followed by a number. The character will be one of ‘U” or ‘D’ which stand for “up” and “down” respectively. The function will create a new Volume object and then process each line of the file by calling the appropriate method of the Volume object which changes the value of the Volume. The function then returns the final Volume object. Guidelines/hints: This is a standalone function, it should NOT be inside (indented within) the class. It should be listed in the module after the Volume class and without indentation. Note that…arrow_forward
- Use Python for this question: Write a standalone function partyVolume() that takes accepts one argument, a string containing the name of a file. The objective of the function is to determine the a Volume object that is the result of many people at a party turning the Volume up and down. More specifically: the first line of the file is a number that indicates the initial value of a Volume The remaining lines consist of a single character followed by a space followed by a number. The character will be one of ‘U” or ‘D’ which stand for “up” and “down” respectively. The function will create a new Volume object and then process each line of the file by calling the appropriate method of the Volume object which changes the value of the Volume. The function then returns the final Volume object. Guidelines/hints: This is a standalone function, it should NOT be inside (indented within) the class. It should be listed in the module after the Volume class and without indentation. Note that…arrow_forwardIn c++ creates a function checkWord that:1) uses an input file stream to read input file (file1) containing correctwords from the English dictionary into a proper STL container.2) uses an input file stream to read another input file (file2) containinguntrusted English.3) Words that we need to check its correctness against the trusted filefrom the dictionary.4) Prints the incorrect words in file2 after checking it against file1.5) If there are no incorrect words, the function should print “All wordsare correct”.arrow_forwardWrite a function called login that accepts 3 parameters: userName:str, password: str, and data: dictionary. The data parameter is a dictionary containing userName keys and associated passwords for values. Your function is the check if the username and password passed by parameter are a matching key:value pair in the data dictionary. in python If the username is not a valid key in data it should return the string "The user name was not found" If the password is not correct for a username that is found in the data dictionary it should return the string "The password was incorrect" If the username is associated with a correct password it should return the string "Login successful" You can create an empty dictionary with dictionary() [ ] ( ) { } This data structure stores a collection of objects in an unordered manner where each object must be unique dictionary set tuple listarrow_forward
- Write a program in C++ that reads a list of enrollments from a file and prints a class roster for the teacher. The program would use files, functions, and classes.Here's what the output should look like: $ ./enroll.out Welcome to the Roster Generator Program!!! Please enter the name of your names file: bob.dat I'm sorry, I could not open 'bob.dat'. Please enter another name: csc442 File 'csc442' opened successfully! Name | Major | Phone # | Town ----------------+--------------------+---------------+------------------- Jason James | Computer Science | 555/555-1122 | Westfalia, HI 665 Faruk Ahmed | Medeaval French Po | 332-4546 | Slimsville, PQ 22 Sean Ramirez | Underwater Basket | 1-444/411-441 | Fritter, HO 44331 Happy Gilmore | Yellow Tail Migrat | | Simonton, SZ 1124 Total Enrollment: 4 Thank you for using the RGP!! Endeavor to have a gyroscopic day! $arrow_forwardWrite a oop c++ program to implement a telephone directory using formatted I/O file. You should write a class TeleDirectory for storing the name, number and address of telephone holder. Your program should be capable of writing name, telephone number and address into a data file teledir.txt. Then write class functions searchByName: which should read the file and must return the Phone number of searched person and searchByNumber : which should read the file and must return the name of person holding the searched phone number. Also write a class function printDirectory which must read the complete directory and print all the records of the directory.arrow_forwardIn C++ Please: The class and functions need to be on an .h file while the main needs to be small and on a seperate .cpp file. Create a class AccessPoint with the following attributes: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Also, add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overlap that checks if two access points overlap their coverage and returns true if they overlap. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Test…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr