Starting Out with C++
8th Edition
ISBN: 9780133888201
Author: GADDIS
Publisher: PEARSON CUSTOM PUB.(CONSIGNMENT)
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 12, Problem 27RQE
Program Description Answer
“structure” provides a suitable method to organize data into fields and records.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Program in C language the creation of a vector of n=5 records, each record made up of the following fields: ProductName, Quantity, Price, Include the following functions:.a) vector reading.b) Screen printing.c) Save the Vector to a file.d) Read the vector from a file.e) main().
Write a program in c
Build an application for a car rental company. It should offer the following features: • Maintain a customer database in a file:o Register / add new customers. Customer information should include ▪ Customer ID number▪ Name▪ Phone numbero Searchcustomerdatabaseby:▪ Customer ID number▪ Name▪ Phone numberAnd print out the matching records• Maintain a database in a file:o Add a new vehicle to the fleet. Vehicle information should include▪ Model year▪ Make▪ Model name▪ License plate number▪ Customer number who is currently renting vehicleo Deleteavehiclefromthefleeto Rent a vehicle to a registered customero Receiverentedvehiclebackfromcustomer o Search vehicle database by any field:▪ Model year + Make + Model name▪ License plate number▪ Customer number who is currently renting vehicle And print out all matching records
You must convert this C file into C++ environments without using Classes conceptCODE: CONTACT MANAGEMENT SYSTEM#include<stdio.h>#include<conio.h>#include<string.h>#include<process.h>#include<stdlib.h>#include<dos.h>struct contact{ long ph; char name[20],add[20],email[30];} list;char query[20],name[20];FILE *fp, *ft;int i,n,ch,l,found;int main(){main: system("cls"); /* ************Main menu*********************** */ printf("\n\t **** Welcome to Contact Management System ****"); printf("\n\n\n\t\t\tMAINMENU\n\t\t=====================\n\t\t[1] Add a new Contact\n\t\t[2]List all Contacts\n\t\t[3] Search for contact\n\t\t[4] Edit aContact\n\t\t[5] Delete a Contact\n\t\t[0]Exit\n\t\t=================\n\t\t"); printf("Enter the choice:"); scanf("%d",&ch); switch(ch) { case 0: printf("\n\n\t\tAre you sure you want to exit?"); break; /* *********************Add new contacts************ */ case 1: system("cls"); fp=fopen("contact.dll","a"); for (;;) {…
Chapter 12 Solutions
Starting Out with C++
Ch. 12.1 - Which file access flag would you use if you want...Ch. 12.1 - Prob. 12.2CPCh. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Write a statement that defines an fstream object...Ch. 12.5 - Assume the file input.txt contains the following...Ch. 12.5 - Describe the difference between reading a file...Ch. 12.5 - What will be stored in the file out.txt after the...Ch. 12.10 - Describe the difference between the seekg and the...
Ch. 12.10 - Describe the difference between the tellg and the...Ch. 12.10 - Describe the meaning of the following file access...Ch. 12.10 - What is the number of the first byte in a file?Ch. 12.10 - Briefly describe what each of the following...Ch. 12.10 - Describe the mode that each of the following...Ch. 12 - What capability does the fstream data type provide...Ch. 12 - Which file access flag do you use to open a file...Ch. 12 - Assume the file data.txt already exists, and the...Ch. 12 - How do you combine multiple file access flags when...Ch. 12 - Should file stream objects be passed to functions...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - How do you read the contents of a text file that...Ch. 12 - What arguments do you pass to a file stream...Ch. 12 - What arguments do you pass to a file stream...Ch. 12 - Prob. 12RQECh. 12 - Prob. 13RQECh. 12 - How do you get the byte number of a files current...Ch. 12 - If a program has read to the end of a file, what...Ch. 12 - How do you determine the number of bytes that a...Ch. 12 - How do you rewind a sequential-access file?Ch. 12 - The _____ file stream data type is for output...Ch. 12 - If a file fails to open, the file stream object...Ch. 12 - The same formatting techniques used with...Ch. 12 - The _____ function reads a line of text from a...Ch. 12 - The ____________ member function reads a single...Ch. 12 - The ________member function writes a single...Ch. 12 - Prob. 24RQECh. 12 - __________ files contain data formatted as...Ch. 12 - Prob. 26RQECh. 12 - Prob. 27RQECh. 12 - The ___________ member function writes raw binary...Ch. 12 - The __________ member function reads raw binary...Ch. 12 - Prob. 30RQECh. 12 - In ___________ file access, the contents of the...Ch. 12 - In __________ file access, the contents of a file...Ch. 12 - The _____________ member function moves a files...Ch. 12 - The ___________ member function moves a files...Ch. 12 - The __________ member function returns a files...Ch. 12 - The ___________ member function returns a files...Ch. 12 - The __________ mode flag causes an offset to be...Ch. 12 - The __________ mode flag causes an offset to be...Ch. 12 - The ________ mode flag causes an offset to be...Ch. 12 - A negative offset causes the files read or write...Ch. 12 - Write a statement that defines a file stream...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write a program segment that defines a file stream...Ch. 12 - Write code that opens the file data.txt for both...Ch. 12 - Write code that determines the number of bytes...Ch. 12 - The infoFile file stream object is used to...Ch. 12 - T F Different operating systems have different...Ch. 12 - T F fstream objects are only capable of performing...Ch. 12 - T F ofstream objects, by default, delete the...Ch. 12 - T F ifstream objects, by default, create a file if...Ch. 12 - T F Several file access flags may be joined by...Ch. 12 - T F A file may be opened in the definition of the...Ch. 12 - T F If a file is opened in the definition of the...Ch. 12 - T F A file stream objects fail member function may...Ch. 12 - T F The same output formatting techniques used...Ch. 12 - T F The operator expects data to be delimited by...Ch. 12 - T F The getline member function can be used to...Ch. 12 - T F It is not possible to have more than one file...Ch. 12 - T F Binary files contain unformatted data, not...Ch. 12 - T F Binary is the default mode in which files are...Ch. 12 - T F The tellp member function tells a file stream...Ch. 12 - T F It is possible to open a file for both input...Ch. 12 - fstream file(ios::in | ios::out);...Ch. 12 - ofstream file; file.open (info.dat, ios::tin); if...Ch. 12 - fstream file("info.dat"); if (!file) { cout ...Ch. 12 - fstream dataFile("info.dat", ios:in | ios:binary);...Ch. 12 - Prob. 69RQECh. 12 - fstream dataFi1e("info.dat", ios:in); char...Ch. 12 - Prob. 71RQECh. 12 - fstream inFile("info.dat", ios:in); int x;...Ch. 12 - File Head Program Write a program that asks the...Ch. 12 - File Display Program Write a program that asks the...Ch. 12 - Punch Line Write a program that reads and prints a...Ch. 12 - Tail Program Write a program that asks the user...Ch. 12 - Line Numbers (This assignment could be done as a...Ch. 12 - String Search Write a program that asks the user...Ch. 12 - Sentence Filter Write a program that asks the user...Ch. 12 - Array/File Functions Write a function named...Ch. 12 - File Encryption Filter File encryption is the...Ch. 12 - File Decryption Filter Write a program that...Ch. 12 - Prob. 11PCCh. 12 - Prob. 12PCCh. 12 - Inventory Program Write a program that uses a...Ch. 12 - Inventory Screen Report Write a program that reads...Ch. 12 - Average Number of Words If you have downloaded...Ch. 12 - Customer Accounts This program should be designed...
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
- IN java YOUR TASK IS TO IMPLEMENT A JAVA APPLICATION WHICH WILL FUNCTION AS A TYPE OF STUDENT REGISTRATION DATABASE WHICH WILL ENABLE AN ADMINISTRATIVE USER TO EITHER CREATE OR DELETE A STUDENT ACCOUNT IN THE DATABASE IN ORDER TO STORE THE FOLLOWING DETAILS:- (1)THE STUDENT’S NAME, (4) THE STUDENT’S ID NUMBER, (3) A LIST OF THE COURSES WHICH THE STUDENT HAS TAKEN ALONG WITH THE CORRESPONDING GRADES FOR THESE COURSES. NOTE: WHEN THE VALUE -1 IS ENTERED, THE APPLICATION WILL TERMINATE. please check the attached imagearrow_forwardUsing C language in visual studio,arrays,pointers,functions,and if possible using a switch case. Build an application for a car rental company. It should offer the following features: 1-• Maintain a customer database in a file: o Register / add new customers. Customer information should include ▪ Customer ID number ▪ Name ▪ Phone number o Search customer database by: ▪ Customer ID number ▪ Name ▪ Phone number And print out the matching records And an option to go back 2-• Maintain a database in a file: o Add a new vehicle to the fleet. Vehicle information should include ▪ Model year ▪ Make ▪ Model name ▪ License plate number ▪ Customer number who is currently renting vehicle o Delete a vehicle from the fleet o Rent a vehicle to a registered customer o Receive rented vehicle back from customer o Search vehicle database by any field: ▪ Model year + Make + Model name ▪ License plate number ▪ Customer number who is currently renting vehicle And print out all matching records And an…arrow_forwardIn C LANGUAGE: You will build a system to manage patients’ data in a hospital. The hospital patient management system stores specific information in the form of health record to keep track of the patients’ data.Your program should read the information from a file called “patients.txt” that should be on the following format: Patient Name#Gender#Date of admission#Date of birth #Illness#Address (City)#Blood typeExample of data input: Abed Mukhles#M#2212019#01012000#Ear Infection#Jenin#O+ Nadia A. Ali#F#01102020#05101970#COVID-19#AlBireh#A-1. You are required to implement a program to help creating the system by including the following operations of an AVL tree:• Read the file patients.txt and load the data (i.e., AVL Tree).• Insert a new patient from user with all its associated data.• Find a patient and give the user the option to update the information of the patient if found.• List all patients in lexicographic order with their associated information.• List all patients that have the…arrow_forward
- Question 3Create a structure containing five strings: address1, address2, city, state, andzip. Create a typedef called RECORD that can be used to create instances ofthis structure.arrow_forwardType of data structures, data values of different types are grouped and stored. Which of the following is the correct answer? a. homogenous b. pointer c. linked list d. non-homogenousarrow_forwardThe Directory class has a list of names in it. You should use dynamic memory to create anarray upon instantiation. You should create a copy constructor for the directory class and anassignment operator (i.e. operator=()). You should create a function called fillDirectory whichaccepts a size for the directory and the names for it both of which should be given by the user.In main, create directory1 and fill it with information. Use the assignment operator=() to setdirectory2 equal to directory1. This is in c++arrow_forward
- (( C# object oriented programming )) the question is in attach: I will sent the code for the question, I need another way, you can update this code: Begin:*************** using System; namespace Rectangle { class Program { static void Main(string[] args) { Rectangle[] rectArray = new Rectangle[2]; rectArray[0] = new Rectangle(); rectArray[1] = new Rectangle(10, 20, 1, 2); for (int index = 0; index < rectArray.Length; index++) { Console.WriteLine("Rectangle " + (index + 1) + " details"); Console.WriteLine("Area: " + rectArray[index].GetArea()); Console.WriteLine("Perimeter: " + rectArray[index].GetPerimeter()); Console.WriteLine(); } } public class Rectangle { private int length; private int width; private int coorx; private int coory;…arrow_forwardInstructions Write a C/C++ program that calculates the least squares line for two sets of values. The program consists of several functions which are described below. int ReadFile (int *, int *); Write a function that reads the contents of a text file (Data1.txt) into two separate integer arrays. The function receives two integer pointers to arrays as parameters. The contents of the text file that is attached is structured as follows: Each line in the file contains two values that are separated by a comma. The values on the left of the comma, are stored in one array and the values on the right side is stored in the other array. The number of lines that are read from the file and stored in the arrays are returned to the calling statement. Tip: a single fscanf can read into multiple variables. Ex. the statement fscanf(fp, "%s %s\n", name,surname) will read the line John Doe and save the name and surname separately. (Note the space between %s and %s indicates that there is a space in the…arrow_forwardIN C++ Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use the find() function to find the index of a comma in each…arrow_forward
- struct Info { int id; float cost; }; Given the struct above, the following code segment will correctly declare and initialize an instance of that struct. Info myInfo = {10,4.99}; Group of answer choices True False ============== Consider the following code fragment. int a[] = {3, -5, 7, 12, 9}; int *ptr = a; *ptr = (*ptr) + 1; cout << *ptr; Group of answer choices 4 -5 3 Address of -5 =============== What will happen if I use new without delete? Group of answer choices The program will never compile The program will never run The program will run fine without memory leak None of thesearrow_forwardCreate an Organization class. Organization has 10 Employees (Hint: You will need an array of pointers to Employee class) Organization can calculate the total amount to be paid to all employees Organization can print the details(name & salary) of all employees note: write code in main,header and function.cpp filearrow_forwardYou must use C++ as the programming language. Please do the following: Create a program that illustrates C++ data structures. Your program should do the following: Essentially create a mini “database” about cars. o There will be a custom data structure that stores the details of cars. Each car will have a make, a model, a year of introduction to the market, a Boolean option for auto, or manual and a recommended retail price. o When the program starts it should ask the user to enter the details about 3 different cars (in an array of the data structure above). o When the input is done, the program should display a menu with the following options: See car details (this option will allow you to choose a car and see it’s details) Update car details (this option will allow you to change the details of a specific car) Print all car details (this option will allow you to print all the details of all cars to the console) Save cars (this option will allow you to save the car details of…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education