Write a function void saveByDept(char *fileName, char *deptName , student allStudents[], int size) that will save the information of all students who belong to the department with name pointed to by deptName into a text file. The name of the file is given as an input parameter, fileName
Q: text file called attendance.txt which records the student daily attendance for Class A and B. Day…
A: c is having in built functions to open a file in read and write mode. We just need to use fopen…
Q: Write a function that takes two lists of integers X and Y as input, and computes and writes a table…
A: def op2file(X, Y): f = open("question2.txt", mode='x') for x in X: for y in Y:…
Q: QUESTION 30 Write a Python function which will find the longest word in a file. The name of the file…
A: Required:
Q: P1. Write a Python function called reduceWhitespace that is given a line read from a text file and…
A: the- program code in python is given below:
Q: Assume that there is a valid file cards.txt in the current directory which contains 10 valid int…
A: int cardsMax() { FILE* file = fopen("cards.txt", "r"); /*Assuming that each integer would be…
Q: Please code in python Write a function to diaply the total word count in a file. Input parameter…
A: 1) Below is program to define a function to display the total word count in a file It defines a…
Q: Write a C++ program to create a new file named "college.txt" to store list of colleges under Punjab…
A: C++ program to create a new file to store the list of colleges under the Punjab University. The name…
Q: Mrite a function that takes two lists of integers x and Y as input, and computes and writes a table…
A: def op2file(X, Y): f = open("C:\\Users\\Dell\\OneDrive\\Desktop\\question2.txt", "w") for i in…
Q: Write a function sum_file(f) that takes a filename f. Each line in f contains a single number. You…
A: #python program def sum_file(f): sum=0 file=open(f,"r")#open file for reading…
Q: Each line of a hockey file contains a four-digit year, a team name, and a two-digit number of wins.…
A: The text for the code is given below: f = open('hockey.txt')lines = f.readlines()f.close() def…
Q: a text file named FIRST.TXT contains some text written into it, write a function named copyupper(),…
A: 1. Open "FIRST.TXT" and "SECOND.TXT" files in a separate file pointer(say fin and fout ). 2. Read…
Q: Q2: Suppose that the file (employee.txt) shown in the figure was stored in the default path, the…
A: Required:
Q: Modify the following program by use functions fgetc and fputs rather than getchar and puts. The…
A: Modified program is attached in next step
Q: Create a new file in c++ and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create…
A: Program Instructions:In the header file, create a temporary variable temp of the data type of each…
Q: Write a function file_copy that takes two string parameters (in_file and out_file) and copies the…
A: Python code :: #!usr/bin/env python def file_copy(infile, outfile): in_f = open(infile,'r') #…
Q: Write a function find_decrypted_words() that takes a file name as parameter, reads that text file…
A: Given:
Q: Q3: For the same program in Q2, write another function that is receives a file stream object for the…
A: Read data from file Have a variable max which is initialized to 0 initially Now iterate over the…
Q: Write a file that defines a function called MyFunction that takes three arguments, px, py and pz.…
A: Program Plan: Since no language is specified in the question, the following code is written in the C…
Q: Python: Character Histogram
A: Summary: In this question, we have been one program and we have to write the code in python. In…
Q: Write a void function that will merge the contents of two text files containing the chemical…
A: This question is solved by C languages Programming. Program Plan :- merge2binary.c Define a…
Q: 2. Using the algorithm developed above, create a function that determines the status of the first…
A: Create a text file. file.txt contains:
Q: Given matrix A and vector b write a function file that returns f = A*b and a matrix B where B has…
A: Find the java code to do so attached.
Q: Write a short notes on the following appending to a file deleting a file
A: a short notes on the following appending to a file deleting a file
Q: 1. Write a function that reads any text file with a given filename and returns the count of a unique…
A: CODE : import string #importing string library from nose.tools import assert_equal ,…
Q: 1. Write a function that, given a file path/name as a string opens the file and returns its entire…
A: According to the information given:- we have to use char *getFileContents(const char *filePath)…
Q: 2. Write a C program that process an unknown number of student information from student.txt which is…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Write a function that generates a file with following parameters: def fillFile(fileSize, fileName):…
A: I will be using python to solve this question. Please thumbs up if i am able to help you :-)
Q: Write a function definition called, sigma, that takes an input file reference and two integer…
A: answer: writing this code in java : main function:public static void main(String[] args) {…
Q: Write a function that accepts the name of a file as it's only argument. The function should open the…
A: The following are steps need to be taken for the given program: Using the open() function, for…
Q: Define a function named get_freq_of_e_ending_words(filename) that takes a filename as a parameter.…
A: Source code summer.py def get_freq_of_e_ending_words(filename): myFile = open(filename, 'r')…
Q: Q2: Suppose that the file (employee.txt) shown in the figure was stored in the default path, the…
A: Open file to read data using ifstream Open another file to write data using ofstream
Q: Write a C++ function (along with helper functions if required) that takes a file stream as a…
A: Write a C++ function (along with helper functions if required) that takes a file stream as a…
Q: Write a function reverse_file(f) that takes a file name f. After your function runs, the lines in f…
A: file can be opened by specifying the file location and mode of operation
Q: HW1: Write a CPP program that reads items names and items prices of 50 items from KB and stores them…
A: reads items names and items prices of 50 items from KB and stores them in a file (prices.txt)…
Q: 2. Extend the gpasort program so that it allows the user to sort a file of students based on GPA,…
A: The above program is solved using Python below:
Q: Write a function to output patient information that are stored in a file. One of the parameters of…
A: Since the to be used is not specified we will write the program in the python. Let us consider that…
Q: 2. Using the algorithm developed above, create a function that determines the status of the first…
A: The function status of return type void and four parameters can be defined to find the status of…
Q: Write a function that accepts names of two files: source and target as arguments and copies…
A: Let's see the solution in the next steps
Q: 9. Write a Python function called remove_word that accepts two file names and a string as arguments.…
A:
Q: Write a function named take_input() that asks the user for the names (strings) of the owner and the…
A: Step 1: Define function take_input() that opens the file "inventory.txt" in write mode. Step 2:…
Q: Create a file named "pointer.c" and include the header file "pointer.h" Implement all functions…
A: We need to write a C program for the given scenario.
Q: 1. Write a function that reads any text file with a given filename and returns the count of a unique…
A: Below I have provided Python Programming. Also, I have attached the screenshot of the code and…
Q: Write a function that accepts names of two files: source and target as arguments and copies…
A: File opening modes in python: A file is opened to read or write or append using the mode of…
Q: Complete the below function that takes a file name and a list as arguments and reads the text within…
A: For most of the understanding, I have added the comments in the code To run the code just enter the…
Q: Write a C++ program to create a new file named “college.txt” to store list of colleges under Punjab…
A: Required: Write a C++ program to create a new file named “college.txt” to store list of colleges…
Q: Write a C function named void skip_a(FILE *fp,char *in) which prevents to write lower case letter…
A: To solve this we need to loop until we reach the end of the string which is indicated by '\0' and…
Q: Write a function that takes two lists of integers X and Y as input, and computes and writes a table…
A:
Q: 3. Which of the following is correct for header files? A. Header files are also called as library…
A: Correct options: 3. D 4. D
Write a function void saveByDept(char *fileName, char *deptName , student allStudents[], int size) that
will save the information of all students who belong to the department with name pointed to by deptName
into a text file. The name of the file is given as an input parameter, fileName
Step by step
Solved in 2 steps with 1 images
- Write a function count_character(filename, character) that takes in a filename and a character, both as strings, and returns the total number of times the given character occurs in the file. Examples: Contents of hello.txt:HelloHELLOHelloHELLO count_character('hello.txt', 'L') returns 4count_character('hello.txt', 'H') returns 4count_character('hello.txt', 'e') returns 2 Requirements: Please use Python Programming only Show screenshot of your work.Write 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')3Write a void function that will merge the contents of two text files containing the chemical elements into a single binary file. The function's parameters will be three file pointers; each text file will contain an integer atomic number followed by the element name, chemical symbol and atomic weight. Here are two sample lines: 11 Sodium Na 22.9920 Calcium Ca 40.08 The function can assume that one file does not two copies of the same elements and that the binary output file should have the same property. IN C PLEASE
- 3. Write a function which reads an already existing file “File1.txt” and write digits (0-9) in to a new text file “mynumber.txt” and non digits into a file “Text.txt”.in c++1. Write a function num_double to read file (f1.txt), double all the numbers, keep the string (no change), and write to another file (f2.txt), for example: >>># f1.txt-“I have 5 books and 3 pens...” >>> f2 = num_double(f1) >>> # f2.txt – “I have 10 books and 6 pens ...”Write a function named take_input() that asks the user for the names (strings) of the owner and the company, and the names (strings), unit prices (floats), stock quantities (ints) of at least 3 products, and writes this information in a new text file using the following format. owner_name,company_name product1_name,product1_unitprice,product1_stock product2_name,product2_unitprice,product2_stock product3_name,product3_unitprice,product3_stock The name of this text file can be taken as an input parameter of your function or you can choose to use a pre-determined (fixed) name inside of this function. Your function must use exception handling to handle all possible run-time errors so that this function does not crash. Please enter your name >> Bond Hi Bond, please enter your company name >> Mart 007 Let's set up a sales menu for 'Mart 007'. Enter item 1's name >> Spiked Umbrella Enter item 1's unit price >> 7.25 Enter item 1's quantity >> 5 Enter item…
- Write a function that reads a single line of numbers from a file named "question1.txt", and returns the average of the numbers read. For example, if the file is as follows: question1.txt 1 3 5 -2 4 0 6 -2 -3 then the function must return 12/9 = 1.33333 def file_average()= in python(5) Write a function called copy_even_lines() that takes two strings (filenames) as input parameters and copies every other line from the first file into the second. That is, counting from 0, it copies the 0th line, the 2nd line, the 4th line, etc. from the first file to the second file. You may assume that both files exist. (6) Write a python program that asks the user for two filenames and calls your function copy_even_lines() from (5) using those two filenames. If one or more files do not exist, your program must handle the exception by repeating the prompts until valid filenames are entered.Write a function called max_age(inFile, outFile, breed) for a (python program), that takes three strings as input parameters. The function reads all the data from the inFile (1st input parameter) and writes data to the outFile (2nd input parameter) as described below. Each line in the input file represents a pet record and has the following format. name, breed, age where name and breed are strings, and age is an integer value. Your function must find the oldest pet of a given breed (3rd input parameter) from the inFile and write the following information to the outFile. breed, total records of this breed name of the oldest pet, age of the oldest pet Note that outFile must only have these two lines of information. Suppose, inFile contains the following data: shadow, longhair, 3 poshi, bangal, 5 mikus, longhair, 4 tigger, calico, 9 If you call this function with breed = "longhair", then the following must be written in the outFile: longhair, 2 mikus, 4 Your…
- In 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”.Write a function reverse_file(f) that takes a file name f. After your functionruns, the lines in f should be reversed from bottom to top. use pythonWrite a function that reads a single line of numbers from a file named "question1.txt", and returns the average of the numbers read. For example, if the file is as follows: ----- question1.txt -----1 3 5 -2 4 0 6 -2 -3------------------------- then the function must return 12/9 = 1.33333