C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Assume the following C code is stored in a file named main.c. Please split it into two files where each file
contains one function. Specify the content of each file and extra files (and contents) that might be needed.
void swap(int *a, int *b){
int temp = *a;
*a = *b;
*b = temp;
}
void main(){
int a = 5;
int b = 6;
swap(&a, &b);
}
Answer
Function_______________ is generally used to write data to a random-access file.
Chapter 14 Solutions
C++ How to Program (10th Edition)
Ch. 14 - (Fill in the Blanks) Fill in the blanks in each of...Ch. 14 - (File Matching) Exercise 14.3 asked you to write a...Ch. 14 - (File Matching Test Data) After writing the...Ch. 14 - Prob. 14.8ECh. 14 - (File-Matching Enhancement) Its common to have...Ch. 14 - Write a series of statements that accomplish each...Ch. 14 - Prob. 14.11ECh. 14 - (Telephone-Number Word Generator) Standard...Ch. 14 - (sizeof Operator) Write a program that uses the...Ch. 14 - Prob. 14.14MAD
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (Data processing) Write a C++ program that reads the file created in Exercise 4, permits the user to change the hourly wage or years for any employee, and creates a new updated file.arrow_forward9act1 Please help me answer this in python programming.arrow_forward** Java Programming ** Please Use Basic Java not GUI •Pharmacy Management System• Your job is to think of a scenario of a Pharmacy! Where various types of medicines are sold! In this pharmacy, there will be 3 parts! Part-1: Admin In the admin part, the admin can add, delete medicines serially wherever he wants! (Medicine Name, Price)! All the added medicines will be stored in ‘Medicine.txt File’ there will be an admin id password! If the input password is wrong it will throw an exception! Part-2: Customer In the Customer Part, There will be 3 portions 1st one is for Sign Up, 2nd one is for Login and the last one is continuing as a guest! In Sign up part, the Customer needs to sign up for Shop Membership. After successful signup customers' data(name, age etc.) will be stored in a different file named ‘Customer Info.txt’! Then log in, in this portion customer needs to log in to his account to buy medicine! The customer will input the serial number and the quantity of the medicine which…arrow_forward
- write a complete statement write the declaration of P (a pointer to integer) * write the declaration of fin (input file stream that opens the file "mydata.txt") * write the declaration statement for funx (a float function with two integer arguments x and y both passed by reference) * read a character from the file fin and assign it to the variable T. * declare a pointer with the name Pnt1 to that points to the integer variable X. * close the file fin * Make the value pointed to by the pointer Ptr zero. *arrow_forward1. Declare a file pointer called input. Open a file called location.txt for reading using this pointer. 2. If the file is not available, display “File does not exist. ". 3. The content of the text file location.txt is as shown below. It includes the location, latitude and longitude values. FILE location.txt CONTENTS UTM 1.5523763 103.63322 KLCC 3.153889 101.71333 UM 3.1185 101.665 UMS 6.0367 116.1186 UNIMAS 1.465174 110.4270601 Ask the user to enter a location. Check if the user's location can be found in the text file. If found, display the location, latitude and longitude as shown below. SAMPLE OUTPUT Enter a location: UM : UM : 3.1185 : 101.6650 Location Latitude Longitude Otherwise display “Sorry, location could not be found". SAMPLE OUTPUT Enter a location : MMU Sorry, location could not be foundarrow_forward1 Goals Use C++ to read data from a text file and create an array of numbers. Use the C++ 'fstream' library functions to open, read and close a text file. You can use the C++ 'iomanip' library to format your output and manage whitespace on your input. Graduate students must create and write the data to a new text file. 2 Your assignment is to create a program that does the following: a. You will need to create a new file (you can do this in the file system – make it plain text) and call it mydata.txt. b. Put a column of numbers in the text file to read later. Pay attention to type – make them all have decimal points. In repl.it, use the numbers in my file. c. Based on the examples in the slides (L3) and the textbook, write a C++ program, include 'iostream' and 'fstream'. You might need 'iomanip'. d. Your program should read the numbers from the file into an array and print the array to the console in reverse order using a for loop. e. Graduate Students must also print the output to a…arrow_forward
- Instructions: You are strictly not allowed to use anything other than pointers and dynamic memory. One function should perform one functionality only. Task 1 Write a program in C++ that reads data from a file. Create dynamic memory according to the data. Now your task is to perform the following task. Row wise Sum Column wise Sum Diagonal wise Sum Example data.txt 4 5 1.6 10.2 33.7 99 20.5 3 44 50 96.1 2 8 9 4 74 50 99 19.1 Output: Sum row wise: 165, 191, 17, 242.1 Sum col wise: 127.6, 120.1, 228.8, 118.1, 20.5 Sum diagonal wise: Not Possible Note: You are restricted to use pointers and your function should be generic. Avoid memory wastage, memory leakage, dangling pointer. Use regrow or shrink concepts if required.arrow_forwardSolve using functionsarrow_forwardAlert dont submit AI generated answer.arrow_forward
- 1. Outputting Type Sizes to a File (50): Write a C program that uses the sizeof operator to determine the sizes in bytes of the various data types on your computer system. Write the results to the file "datasize. dat" so you may print the results later. The format for the results in the file should be as follows: Data type Size char 1 unsigned char short int 2 unsigned short int int 2 unsigned int long int unsigned long int float 4 4 4 double 8 long double 16 (The type sizes on your computer might be different from those shown in the sample output)arrow_forwardFunction ____________opens a file.arrow_forwardWrite a program in C++ to do the following: 2. Create an array to hold up to 20 integers. 3. Create a data file or download attached text file (twenty_numbers.txt) thatcontains UP TO 20 integers.4. Request the input and output file names from the user. Open the filesbeing sure to check the file state.5. Request from the user HOW MANY numbers to read from the data file,up to twenty. Request the number until the user enters 20 or less, but not lessthan 0. The user enters the number of integers to read. The integers are storedin the file and are to be read from the file.6. Write a function that reads from the opened data file: the numberof integers the user wants to read, and store the numbers inthe array. For example, if the user wants to read 13 numbers,read 13 of the 20 that may be in the file.7. Write a function that writes to the opened output file AND THECONSOLE, the numbers stored in the array.8. NO GLOBAL variables are to be used. The input and output file variablesmust be passed…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License