Write the definition for a void function called textToScreen that has one formal parameter called fileStream that 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. //Postcondition: The contents of the file connected to //fileStream have been copied to the screen character by //character, so that the screen output is the same as the //contents of the text in the file. //(This function does not close 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
Absolute Java (6th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Python (4th Edition)
Starting Out with Java: Early Objects (6th Edition)
- Write a C/C++ program that: Writes a function, readFile(), that reads the content of the provided text file “stnumbers.txt” and stores it in an array of Student structs. The function receives as parameter an array of type Student structs. The number of lines that was read from the text file must be returned to the calling statement. If the file cannot be read, an error message should be displayed. stnumbers.txt textfile is given below Peterson20570856Johnson12345678Suku87654321Westley12345678Venter87654321Mokoena79012400Makubela29813360Botha30489059Bradley30350069arrow_forwardPut the class definition in House.h and the implementation of the constructors and functions in House.cpp 1. Define a class called "House", that represents the information of a house. A House is defined with these attributes: age (int), type (string) (for example Detached, Semi-Attached, Attached) and build_cost (double). Functions of the House class must perform the following operations: ✓ A default constructor which sets all the numeric instance variables to zero and the String instance variables to empty String. ✓ A constructor with 3 parameters which sets the 3 instance variables to the corresponding values passed. ✓ Implement a getter function for each of the 3 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable type must be called getType(). ✔ Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the…arrow_forwardWrite a function called countWord(). It takes 2 parameters: The name of a text file(e.g. gettysburg.txt) and a word to be searched within that file. Your code should returnthe number of times the given word appears in the file.>>> countWord('gettysburg.txt', 'people')3arrow_forward
- Problem 5 Solve this problem inside the files problem5-library.c and problem5-library.h. Do not modify any other files for this problem. Write a function called "nextLetter" inside problem5-library.c and add its prototype inside problem5-library.h. • The function must accept 2 parameters, a character then an integer. It will return a character. • The function will return the character that is reached by starting from the passed letter and moving steps equal to the passed integer. Check the examples below: Example: If the parameters were 'A' and 1, the function will return 'B', because 'B' is 1 step away from 'A'. Example: If the parameters were 'e' and 3, the function will return 'h', because 'h' is 3 steps away from 'e'. • If the given letter is uppercase, the returned letter must be uppercase. If the given letter is lowercase, the returned letter must be lowercase. • If the given integer is too big or will cause the letters to reach the last letter, you must restart the letters from…arrow_forwardnum 3 in c ++ answer it as simple as possible with no complicated codes, pleasearrow_forwardIn C languagearrow_forward
- Write 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_forwardProgramarrow_forwardWrite a function file_copy that takes two string parameters (in_file and out_file) and copies the content of in_file into out_file. Assume that in_file exists before file_copy is called. For example, the following would be correct input and output:>>> file_copy('created_equal.txt', 'copy.txt')>>> copy_f = open('copy.txt')>>> copy_f.read()'We hold these truths to be self-evident,\nthat all men are created equal\n'*I am typing this so I can submit as a question as it will not let me without typing this!arrow_forward
- Write a function file_copy that takes two string parameters (in_file and out_file) and copies the content of in_file into out_file. Assume that in_file exists before file_copy is called. For example, the following would be correct input and output: >>> file_copy('created_equal.txt', 'copy.txt') >>> copy_f = open('copy.txt') >>> copy_f.read() 'We hold these truths to be self-evident,\nthat all men are created equal\n'arrow_forwardPlease use Python for this question. Please format code properly when answering the 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 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…arrow_forwardPlease help me code this in Pythonarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr