Implement the following programs in cpp code; 1. Write a program that takes input in 50 employees(id, name, salary, age) and write their data in file employee.txt and find from file salary of an employee with id 13.
Q: Pseudo code:
A: import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import…
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: 4- The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: Hello student Greetings Hope you are doing great. I will try my best to answer your question. Thank…
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: (a) Write a program in C to create a text file named bmi.txt and store the data from the following…
A: Required: create a program to create a text file with the given table. after that create another…
Q: Write a recursive function, displayFiles , that expects a pathname as an argument. The path name can…
A: Here I written Python code as per problem says. I hope you like it.
Q: Using the data file capabilities of C++, create a Personnel file, personnel.dat on your drive and…
A: Program Instructions:Use do-while loop to repeatedly present the menu.Use switch statement to opt…
Q: In C++ Ask the user for three friends names, store the names in an array. Output the array to a…
A: Program://include the required header files#include <iostream>#include<fstream>#include…
Q: 4- The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: Dear learner , hope you are doing well , I will try my best to answer this question. Thank You!!
Q: Muscat marketing research company is conducting a rating survey of different chains of supermarkets.…
A: Program Plan: Read the files as stream. read the file line by line and push the values into the…
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: 3) The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: Actually, database is a used to stores the data/information.
Q: The stream insertion operator << and the stream extraction operator >> are overloadedto…
A: Solution) Stream insertion and stream extraction operators << ,>> can be overloaded in…
Q: "### Exercise 2 Working with a file and numbers ###\n", "\n", "The file grades.txt has the grade for…
A: Task : Read the grades from grades.txt. Find the average grade. Show the average grade of the…
Q: file containing data about some students' options regarding a set of optional subjects is given. The…
A: To read data from the file #include <stdio.h> int main(void){ char name[50000]; int…
Q: 1. Write a C program to take students data which contains Student Name, Roll No., total Marks out of…
A: #include<stdio.h>struct student{ char name[50]; int rollno; float marks;}; int main(){ struct…
Q: 4- The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: The answer is given below:-
Q: Task: Write a program, using functions only, with the following features. 1. Program reads…
A: Actually, string is a sequence of characters.
Q: Write a recursive function, displayFiles, that expects a pathname as an argument. The path name can…
A: import os #required method def displayFiles(pathname): #checking if pathname is a file if…
Q: Consider the binary file named, "Course_Data" whose format is below. Each record represents a course…
A: Course_Data obj; int avg=0; for(int i=1;i<=obj.NOA;i++){ if(obj.LGrade=='A'){ avg+=obj.NGrade; }…
Q: Write a function find_lowers() that takes a file name as a parameter, reads that text file, and…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read file name…
Q: "### Exercise 2 Working with a file and numbers ###\n", "\n", "The file grades.txt has the grade for…
A: The required python program code by using the file operation is given in the next step.
Q: write a function to read the array a[5]. and write another function to print a real address and…
A: Here No language mentioned So I am Providing solutions in c language. Code #include…
Q: A text file contain birth date of some employees with format dd/mm/yy: 01/06/50 03/06/51 10/02/54…
A: task: Read the file using C and find out how many employees with age: –above 51 –between 44 – 51…
Q: Write a recursive function, displayFiles, that expects a pathname as an argument. The path name can…
A: Program Code to Copy import osdef displayFiles(pathname):#Check if path is a fileif…
Q: Write a function named framestr that takes as input a string s, and PRINTS on the screen a framed…
A: len(s) find length of string s '-' * n '-' copy it n times if n=5 '-'*n = '-'*5 = '-----'
Q: B) The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: M-File:- MATLAB editor and other text editors used to create .mfiles A sequence of…
Q: Write a function stat(fName) that takes a filename that contains a matrix of numbers. Your function…
A: Algorithm: Start Open the file in read mode and read the content and store it in a variable By…
Q: Write a function that reads a single line "question1.txt", and returns the average the file is as…
A: Begin by creating a text file and storing numbers in it. I have named my file question1.txt.…
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: By using C++ software Write a C++ program that reads a data file consisting of each student's GPA…
A: #include <bits/stdc++.h>using namespace std; vector <double> grades;map <string ,…
Q: Write a function void saveByDept(char *fileName, char *deptName , student allStudents[], int size)…
A: The following is the solution In saveByDept method File is open in write mode and fprintf has been…
Q: 9. Write a Python function called remove_word that accepts two file names and a string as arguments.…
A:
Q: B) The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: DEGREE=[ 80, 80, 80; 75, 80, 70; 80, 90,…
Q: Read 40 bytes from file called "c:\mytest" after byte number 80 and puts them in array of bytes A[…
A:
Q: c++ programming language Please help me with this program. The task and numbers.txt is attached…
A: The program will take input from user in file.txt file. Then we will calculate the number of…
Q: 4- The Table shown below lists the degrees of three students, Write a program in M-file to read…
A: The program for given problem is as below :
Q: WAP to read 4 student objects and write them into a file, then print total number of student number…
A: The code is written below: #include<iostream> #include<fstream> using namespace std;…
Q: 2. Write a SAS program to read the Admit data set from Mylib, call the new admit data set as…
A: Answer: I have done code and also I have attached code.
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: Q1: write a M-file mat lab program call it Eql.m file to enter a square matrix A(m,m) and find the…
A: Main Diagonal is the elements where row number and column number is same Upper Triangle is 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: Your function must find the oldest pet of a given breed (3rd input parameter) from the inFile and…
A: 1. function max age : parameter infile outfile breed a. open both file in try block b.…
Q: Write a program, using functions only, with the following features. 1. Program reads paragraph(s)…
A: #include <iostream>#include <map> // A map will be used to count the words.#include…
Q: Q2: write a M-file mat lab program call it Eq2.m file to enter a square matrix A(m,m) and find the…
A: A user defined m-file for the problem is as follows
Implement the following programs in cpp code;
1. Write a program that takes input in 50 employees(id, name, salary, age) and write their data in file employee.txt and find from file salary of an employee with id 13.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 1.A text file contain birth date of some employees with format dd/mm/yy: 01/06/50 03/06/51 10/02/54 08/01/48 26/08/51 27/04/54 21/09/51 … and so on Read the file using C and find out how many employees with age: –above 51 –between 44 – 51 –between 36 – 43 –between 28 – 35 –below 28 (note : age = now – birth date) Using C Language, modulo, and file processing, Sir, thx.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.In C++, Query the user for the name of a file. Read the words from the file and report the number of words whose last letter is 'a', the number whose last letter is 'b' and so on, irrespective of case.
- 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 deptNameinto a text file. The name of the file is given as an input parameter, fileNameWrite a program, using functions only, with the following features.1. Program reads paragraph(s) from the file and stores in a string.2. Then program counts the occurrence of each word in the paragraph(s) and stores allwords with their number of occurrences.3. If that word has appeared more than one time in whole string, it should store the wordonly once along its total number occurrences.4. The output described in above (int part 3) must be stored in a new file.This problem needs to be solved in python. Write a function read_movies_data(f) that takes in a movies file and returns a pandas DataFrame, where the index is the movie id and the columns are "title", "year", and "genre" (in that order). movies_df = read_movies_data("moviesSample.txt") assert movies_df.shape == (9, 3)assert movies_df.iloc[2, 2] == "Comedy"assert movies_df.loc[6, "title"] == "Heat"assert all(movies_df.columns == ["title", "year", "genre"])assert list(movies_df.index) == [1, 2, 3, 4, 5, 6, 8, 9, 10] NOTE: Make sure all of the asserts work The moviesSample.txt looks like this: 1|Toy Story|1995|Adventure2|Jumanji|1995|Adventure8|Tom and Huck|1995|Adventure3|Grumpier Old Men|1995|Comedy4|Waiting to Exhale|1995|Comedy5|Father of the Bride Part II|1995|Comedy6|Heat|1995|Action9|Sudden Death|1995|Action10|GoldenEye|1995|Action NOTE: Try to sent screenshots of the code working.
- Write a program in C++ that creates a file. Write this data into that file column wise as a header. Then keep adding data in colum wise format. The program should check if there is data in the file and then write the data in the next row. First add: TIME DAY MONTH YEAR Then check the file and add: 01:25 07 JUNE 2008 Then check again the file and add this in next row: 14:00 30 MARCH 2019Task: Write a program in C++ language, using functions only, with the following features. Program reads paragraph(s) from the file and stores in a Then program counts the occurrence of each word in the paragraph(s) and stores all words with their number of If that word has appeared more than one time in whole string, it should store the word only once along its total number The output described in above (int part 3) must be stored in a new file. Sample input: is the is and the is and the and is and only that is Sample output: is 5 the 3 and 4 only 1 that 1 Note: Make program as simple as possible.Write 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…
- Write 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... ...Implement function duplicate() that takes as input a string and the name of a file in the current directory and returns True if the file contains duplicate words and False otherwise. Hints: remember to save the function and the text file in the same directory. def duplicate(filename): 'Put in docstring’ # get file content infile = ________________# ______________ content = ______________# ______________ infile__________________# ______________ # replace punctuation with blank spaces and obtain list of words table = ________________________ # _______________ words = _______________________ # _______________ # for every word, check if it occurs more than once; if so, return True for word in words: if ______________________ # _____________ _________________# _____________ # no word occurred more than once, so return False ______________ Result of running the function. >>> duplicate('Duplicates.txt') True >>> duplicate('NoDuplicate.txt') FalseWrite a complete C program that does the following:1) Read the data stored in the file "rec.txt" into an array of records containing the student ids and the student names.2) Sort the array of records following the students' names in alphabetical order and display the sorted names on the screen.3) Prompt the user to search for the student id by the student's name.