Starting Out with C++ from Control Structures to Objects (8th Edition)
8th Edition
ISBN: 9780133778793
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 12, Problem 26RQE
Program Description Answer
A “record” contains a set of data about an item and is made up of “fields”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Only C programing Language
Attention : Your answer file name will be your school number-Q1.cpp (ex: 190201231-Q1.cpp)
Engineering Faculty wants to employ research assistants. The information of the candidates who want to be employed as research assistants are written in the sequential access file (candidate.txt) by the registration office, respectively, name, surname, school graduation grade, Academic Personnel and Postgraduate Education Entrance Exam score and foreign language level exam score. All numerical information is being written as decimal numbers(float).
Engineering Faculty is to use that candidate.txt file to calculate the total scores of each candidate. When calculating the candidate's total score, 25% of the school graduation grade, 50% of the Academic Personnel and Postgraduate Education Entrance Exam score, and 25% of the language score are being taken into consideration.
Write a program that reads the entire candidate.txt file and calculates the total score of each…
Time remaining:
01:59:44
Computer Science
//Change the code so that it is a "DataStore with Vectors & 3-files"
#include <iostream>using namespace std;int main(){ int n; cout << "How Many: "; cin >> n;
double *pScore = new double[n]; for (int x = 0; x < n; x++) { cout << "Enter Score: "; cin >> pScore[x]; } for (int x = 0; x < n; x++) cout << pScore[x] << " " << &pScore[x] << endl; return 0; }
(Memory Allocation and Deallocation Operators) Compare and contrast dynamic memoryallocation and deallocation operators new, new [], delete and delete [].
Chapter 12 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
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
Similar questions
- File system implementation: a. Given a flename in a directory’s data block, how does OS locate the data block of a fle? b. Compare between direct pointers and indirect pointers in referencing data blocks. c. Given a 6GB fle, identify the number of index level needed when using indirect pointer.arrow_forwardQ. What is the disadvantage of array data structure? A. The amount of memory to be allocated should be known beforehand. B. Elements of an array can be accessed in constant time. C. Elements are stored in contiguous memory blocks. D. Multiple other data structures can be implemented using arrays.arrow_forwardYou are required to develop a system using Dev C++. You must apply all your knowledgein computer programming to develop your software. You may do the project in groups of 2.ProgrammingYour program should fulfill these requirements:1. The program should be done modularly by applying top-down or bottom-upapproach and use C language2. The program should contain all programming techniques describe in the syllabus.3. The program should utilized the array structure as a database or memory element.4. The program should contain at least 2 level functions.arrow_forward
- 3. Memory (a) How many locations of memory (in terms of the number of bytes) can you address with 17-bit memory address? (b) How many bits are required to address a 64-Mega-location memory, i.e, what should the number of bits of the memory address be in order to access a 64MB memory? (c) Assume A is an integer array with 20 elements stored in memory and its starting memory address is in X3. What is the memory address for element A[5]? (d) Assume C is a character array with 20 elements stored in memory and its starting memory address is in X4. What is the memory address for element C[12]? (e) Write at least five different ways to assign 0 to register X3.arrow_forwardCreate a simple code in VBA to do the 4 basic function of a calculator: Add, Substract, Multiply, Divide. It must have a place to put in 2 different input values. It must have a place to choose the function/arthmetic. It must show the answer when clicking on a button. Save the file as a "Excel Macro-Enable Workbiik(*.xlsm)"arrow_forwardSAME PARAMETERS: In the RENTALS table shown in fig 2, 40 customers have created 50 rental contracts over time. A RENTALS record is 122 bytes and the block size for your OS is set to 1024 bytes with each block having a 1 byte pointer to the next written block as well as a 1 byte pointer to the next physically consecutive block. Assuming spanned organization, how many blocks do you estimate the RENTALS file is using at its current size? multiple choice a.50 b.6 c.400 d.7arrow_forward
- USE C++ The Malaysian Ministry of Health published data on the number of deaths by disease type. There are two types of diseases: dengue and malaria. Write a complete C++ program to accomplish the following tasks: Task 1: Declare parallel arrays in the main function to store the following types of information: a) The year. b) The mumber of deaths caused by each disease type (dengue and malaria). Task 2: Write a function named "readInput". a) This is a non-retuming function. b) It receives parallel arrays defined in Task 1. c) The function should assign the required values to each element of the parallel arrays by reading the data from the text file named "input.txt". The file includes the year as well as the mumber of deaths caused by dengue and malaria. Figure lis the content of the "input. txt" file. Please ensure that the program only contimues reading the file if it is successfully opened; otherwise, print the error message and exit the program. Figure 1: 2007 82 18 2008 112 30…arrow_forwardC++ Please explain the code below. It doesn't have to be long, as long as you explain what the important parts of the code do. You can also explain it line by line for best ratings. Thank you so much! #include "list.h"#include <cstdlib>#include <iostream>#include <cmath>using namespace std;class ArrayList : public List { int* array; int index; int capacity; void dyn_all_add(){ int cap = ceil(capacity * 1.5); array = (int*)realloc(array,cap * sizeof(int)); capacity = cap; } void dyn_all_rem(){ int cap = capacity - (capacity/3); array = (int*)realloc(array,cap * sizeof(int)); capacity = cap; } public: // CONSTRUCTOR ArrayList() { capacity = 4; array = (int*)malloc(capacity); index = 0; } int add(int num) { if (index == capacity){ dyn_all_add(); } *(array + index) = num; index++; return…arrow_forwardC++ Please explain the code below. It doesn't have to be long, as long as you explain what the important parts of the code do. You can also explain it line by line for best ratings. Thank you so much! #include "list.h"#include <cstdlib>#include <iostream>#include <cmath>using namespace std;class ArrayList : public List { int* array; int index; int capacity; void dyn_all_add(){ int cap = ceil(capacity * 1.5); array = (int*)realloc(array,cap * sizeof(int)); capacity = cap; } void dyn_all_rem(){ int cap = capacity - (capacity/3); array = (int*)realloc(array,cap * sizeof(int)); capacity = cap; } public: // CONSTRUCTOR ArrayList() { capacity = 4; array = (int*)malloc(capacity); index = 0; } int add(int num) { if (index == capacity){ dyn_all_add(); } *(array + index) = num; index++; return…arrow_forward
- File system implementation: a. Given a filename in a directory’s data block, how does OS locate the data block of a file? b. Compare between direct pointers and indirect pointers in referencing data blocks. c. Given a 6GB file, identify the number of index level needed when using indirect pointer.arrow_forwardDont use answers from others please! MIPS source programs and the screenshots of your MARS execution windows. Name: .asciiz "James Bond!"Age: .byte 24Numbers: .word 11, 22, 33Letter1: .asciiz 'M' 2. Create the data declaration part of the above by creating a file with MARS and assemble it to show the memory contents. You don't have to have .text part since this is just data declaration only. Capture your screen of MARS execution window by checking "ASCII" option of Data Segment part.arrow_forward______________is NOT a super global array. a. $_GET b. $_REQUEST c. $_ERRORS d. $_SESSIONarrow_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