Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13.3, Problem 13.19CP
What will be stored in the file out.dat after the following
#include <iostream>
#include <fstreara>
#include <iomanip>
using namespace std;
int main()
{
const int SIZE = 5;
ofstream outFile("out.dat");
double nums[ ] = {100.279, 1.719, 8.602, 7.777, 5.099};
outFile << setprecision(2);
for (int count = 0; count < SIZE; count++)
{
outFile << setw(8) << nums[count];
}
outFile.close();
return 0;
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
struct employee{int ID;char name[30];int age;float salary;};
(A) Using the given structure, Help me with a C program that asks for ten employees’ name, ID, age and salary from the user.
Then, it writes the data in a file named out.txt
(B) For the same structure, read the contents of the file out.txt and print the name of the highest salaried employee and youngest employee names name in the outputscreen.
File Handling with Array:
C++ Language:
Write a c++ program to read the data from the file into array and do calculation.
Note: Take a general word problem and write syntax which will use in all problems related to file handling with array.
Finish the C++ code.
Will upvote! thank you
Chapter 13 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - What is the purpose of the second parameter to the...Ch. 13.1 - Why is it important for a program to close an open...Ch. 13.1 - Which file open flag causes all output to take...Ch. 13.1 - Which file open flag causes the contents of an...Ch. 13.1 - What happens if ios: :out is used by itself to...Ch. 13.1 - What happens if ios::out is used by itself to open...Ch. 13.1 - Write a sequence of C++ statements that reads in...Ch. 13.1 - Write a sequence of C++ statements that reads in...
Ch. 13.1 - Show how to use the constructor of the fstream...Ch. 13.1 - Consider two parallel arrays of the same size, one...Ch. 13.3 - Make the required changes to the following program...Ch. 13.3 - Describe the purpose of the eof member function.Ch. 13.3 - Assume the file input.txt contains the following...Ch. 13.3 - Describe the difference between reading a file...Ch. 13.3 - Describe the difference between the getline...Ch. 13.3 - Describe the purpose of the put member function.Ch. 13.3 - What will be stored in the file out.dat after the...Ch. 13.3 - The following program skeleton, when complete,...Ch. 13.5 - Write a short program that opens two files...Ch. 13.5 - How would the number 479 be stored in a text file?...Ch. 13.5 - Describe the differences between the write member...Ch. 13.5 - What arc the purposes of the two arguments needed...Ch. 13.5 - What are the purposes of the two arguments needed...Ch. 13.5 - Describe the relationship between fields and...Ch. 13.5 - Prob. 13.27CPCh. 13.7 - Describe the difference between the seekg and the...Ch. 13.7 - Describe the difference between the tellg and the...Ch. 13.7 - Describe the meaning of the following file access...Ch. 13.7 - What is the number of the first byte in a file?Ch. 13.7 - Briefly describe what each of the following...Ch. 13.7 - Describe the mode that each of the following...Ch. 13 - Prob. 1RQECh. 13 - Before a file can be used, it must first beCh. 13 - When a program is finished using a file, it shouldCh. 13 - The__________ header file is required for file I/O...Ch. 13 - Prob. 5RQECh. 13 - The_____________ file stream data type is for...Ch. 13 - The____________ file stream data type is for input...Ch. 13 - The ______ file stream data type is for output...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write two statements that use the people file...Ch. 13 - Write two statements that use the pets file stream...Ch. 13 - Write two statements that use the places file...Ch. 13 - If a file fails to open, the file stream object...Ch. 13 - Write a program segment that defines a file stream...Ch. 13 - The same formatting techniques used with ______...Ch. 13 - The ______ member function reports when the end of...Ch. 13 - The ______ function reads a line of text from a...Ch. 13 - The _______ member function reads a single...Ch. 13 - The _____ member function writes a single...Ch. 13 - Prob. 22RQECh. 13 - Prob. 23RQECh. 13 - Prob. 24RQECh. 13 - In C++, _______ provide a convenient way to...Ch. 13 - The _______ member function writes raw binary data...Ch. 13 - The _______ member function reads raw binary data...Ch. 13 - The ______ operator is necessary if you pass...Ch. 13 - In _______ file access, the contents of the file...Ch. 13 - In _____ file access, the contents of a file may...Ch. 13 - The _______ member function moves a files read...Ch. 13 - The ______ member function moves a files write...Ch. 13 - The _______ member function returns a files...Ch. 13 - The _______ member function returns a files...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to he...Ch. 13 - A negative offset causes the files read or write...Ch. 13 - Give a pseudocode algorithm for determining the...Ch. 13 - Give a pseudocode algorithm for comparing two...Ch. 13 - Prob. 41RQECh. 13 - Suppose that you have two text files that contain...Ch. 13 - Each of the following programs or program segments...Ch. 13 - File Previewer Write a program that asks the user...Ch. 13 - File Display Program Write a program that asks the...Ch. 13 - Punch Line Write a program that reads and prints a...Ch. 13 - Tail of a File Write a program that asks the user...Ch. 13 - String Search Write a program that asks the user...Ch. 13 - Sentence Filter A program that processes an input...Ch. 13 - File Encryption Filter File encryption is the...Ch. 13 - File Decryption Filter Write a program that...Ch. 13 - Letter Frequencies The letter e is the most...Ch. 13 - Put It Back C++ input stream classes have two...Ch. 13 - Prob. 11PCCh. 13 - Insertion Sort on a File II Modify the program...Ch. 13 - Prob. 13PCCh. 13 - Prob. 14PCCh. 13 - Inventory Program Write a program that uses a...Ch. 13 - Inventory Program Write a program that uses a...Ch. 13 - Group Project 17. Customer Accounts This program...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Finish the program that takes a word as a command-line argument and looks up the word to see whether it is in t...
Programming in C
Suppose you write a program that is supposed to compute the day of the week (Sunday, Monday, and so forth) on w...
Java: An Introduction to Problem Solving and Programming (8th Edition)
Explain how each of the following types of integrity constraints is enforced in the SQL CREATE TABLE commands: ...
Modern Database Management (12th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
What is denormalization?
Database Concepts (7th Edition)
Compile and run the sample code that uses show_bytes (file show-bytes. c) on different machines to which you ha...
Computer Systems: A Programmer's Perspective (3rd Edition)
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
- File Handling with Array: C++ Language: Write a c++ program to read the data from the file into array and do calculation. Note: Take a general word problem which helps in others related questions.arrow_forwardLanguage: C++ Create a class called publication that stores the title (char array) and price (float) of a publication. From this class derive two classes: book, which adds a page count (int) and tape, which adds a playing time in minutes (float). Each of the three classes should have a getdata() function to get its data from the user using input from the keyboard and a putdata() function to display the data.Write a main function that creates an array of pointers to publication. In a loop, ask the user for data about a particular type of book or tape to hold data. Put the pointer to the object in the array. When the user has finished entering data for all the books and tapes, display the resulting data for all the books and tapes entered, using a for loop and a single statement such as: pubarr[j] -> putdata(); To display the data from each object in the array.arrow_forwardvoid Pokedex::wakeupProfessorJimi(std::string) − populates the dynamic array of Entries with data from a valid file path, the function should open the file and use the add (Pokemon*, int) function to insert a Pok ́emon into the correct position in the dynamic array of Entries. Once the position is determined, the Pok ́emon should be inserted into the corresponding position in the list of Pok ́emon belonging to the Entries object. i aready have a pokemon class with enum for types, move class and move class setup and working it's just this one part. here is the text file 1,Bulbasaur,45,49,[Grass,Poison],Fire,Water,[[tackle,40,40,100],[vine whip,45,45,100],[growl,10,10,100]] 2,Ivysaur,60,63,[Grass,Poison],Fire,Water,[[leech seed,45,45,90],[razor leaf,55,55,95],[growl,10,10,100]] 3,Venusaur,80,83,[Grass,Poison],Fire,Water,[[tackle,40,40,100],[leech seed,45,45,90],[razor leaf,55,55,95],[growl,10,10,100]] 4,Charmander,39,43,[Fire],Water,Fire,[[growl,10,10,100],[fire fang,65,65,95]]…arrow_forward
- C++ Dynamic Array Project Part 2arrow_forwardModify pipe4.cpp so that it accepts a message from the keyboard and sends it to pipe5. //pipe4.cpp (data producer) #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> int main() { int data_processed; int file_pipes[2]; const char some_data[] = "123"; char buffer[BUFSIZ + 1]; pid_t fork_result; memset(buffer, '\0', sizeof(buffer)); if (pipe(file_pipes) == 0) { //creates pipe fork_result = fork(); if (fork_result == (pid_t)-1) { //fork fails fprintf(stderr, "Fork failure"); exit(EXIT_FAILURE); } if (fork_result == 0) { //child sprintf(buffer, "%d", file_pipes[0]); (void)execl("pipe5", "pipe5", buffer, (char *)0); exit(EXIT_FAILURE); } else { //parent data_processed = write(file_pipes[1], some_data, strlen(some_data));…arrow_forwardTurn this into a flowchart/pseudo code. //This is where the functions go void insertfront(int data);void insert(int data);void display();void deletedata(int data);void reverselist();void searchdata(int data);void swap();void datasort();void deleteList(); #include <iostream>#include <stdlib.h>using namespace std; struct Node {int data;struct Node *next;}; struct Node* head = NULL;struct Node* rhead = NULL;int count1; //insert in front for reversedlistvoid insertfront(int data){Node* new_node = (Node*) malloc(sizeof(Node)); new_node->data = data; new_node->next = rhead; rhead=new_node;}//insert at endvoid insert(int new_data){Node* ptr;ptr = head;Node* new_node = (Node*) malloc(sizeof(Node)); new_node->data = new_data; new_node->next = NULL;if (head == NULL) { head = new_node; } else{while (ptr->next!= NULL) { ptr = ptr->next;}ptr->next=new_node;}count1++;}//display listvoid display() {struct Node* ptr;ptr = head;if(head==NULL){cout<<"Sorry the list…arrow_forward
- C++: You will create a header file with implementation that performs the task. Together with the header and implementation, you create a test program whose main function demonstrates that your functions work as they should. Two files, A and B which they are sorted. The files contain Numbers. Based on the files, create a third file let calles it C . that file C is going to contain all the elements in sorted order from both files A and B. This algorithm is called a merge..arrow_forwardIn C++ Write a code snippet to automatically increase the size of the dynamic array prayerBox[10] if it becomes full while reading data in from a file.arrow_forwardC++ Programming: How would you write a function that takes a filename and an array of struct time, opens a file, reads each line in the file as the number of days, converts this to a struct time and stores this is in an array? Here is my code so far (p.s. the function i need help with is called void readData): #include<iostream>#include<string>#include<fstream>#include<cstdlib>#include<vector> using namespace std; struct time{// private:int years, months, days;//public: time(){}time(int days){}}; time getYearsMonthsDays(int days){time x;x.years = days/450;days = days%450;x.months = days/30;x.days = days%30;return x;} int getTotalDays(time x){int totalDays;totalDays = x.years*450 + x.months*30 + x.days;return totalDays;} void openofile(string ofilename,ofstream &fout){fout.open(ofilename.c_str());if(!fout){cout << "Error opening output file..." << endl;exit(1);}} void openifile(string ifilename,ifstream…arrow_forward
- C++ ProgrammingTopic: Stack, Ques and DequesBelow is the initial program of the main file, only modify the main file, sllstack file also provided. See attached photo for instructions. main.cpp #include <iostream> #include <cstring> #include "sllstack.h" using namespace std; int main(int argc, char** argv) { SLLStack* stack = new SLLStack(); int test; string str; cin >> test; switch (test) { case 0: getline(cin, str); // PERFORM SOLUTION TO BRACKETS PROBLEM HERE // FYI: Place your variable declarations, if any, before switch. break; case 1: stack->push('a'); stack->push('b'); stack->push('c'); cout << stack->pop() << endl; cout << stack->pop() << endl; cout << stack->pop() << endl; cout << stack->isEmpty() << endl; break;…arrow_forwardin C++ starting code: #include <iostream>// FIXME include vector libraryusing namespace std; int main() { /* Type your code here. */ return 0;} Please copy and paste working code.arrow_forwardC++ Code dynamicarray.h and dynamicarray.cpparrow_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 PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
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