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;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 13 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Degarmo's Materials And Processes In Manufacturing
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Mechanics of Materials (10th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- For c++ pleasearrow_forward. In c write a program that:a) takes an input file name from the command line;b) opens that file if possible;c) declares a C struct with three variables; these will have data types thatcorrespond to the data types read from the file (i.e. string, int, float);d) declares an array of C structs (i.e. the same struct type declared in point c);e) reads a record from the file and stores the values read into the appropriatestruct variable at the appropriate array index (for that record);f) continues reading each record into a struct (as in point 1e), and stores eachstruct containing the 3 values into the array of structs declared in point d;g) closes the file when all records have been read.Note that your program should print an error message in the event that the filecannot be opened successfully.arrow_forwardFinish the C++ code. Will upvote! thank youarrow_forward
- 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_forwardFinish the C++ code. Suppose the file nums.txt contains the following data:arrow_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_forward
- Programming Assignment 1 #include <iostream> #include<iomanip> #include<fstream> #include<sstream> #include<string.h> using namespace std; //Define the main function int main() { //Create the object of fstream class and opening the file ifstream inpfile("order.txt"); string fline; double sub_total, tax, shipping=14.95, grand_total, line_total; double priceA=17.46, priceB=10.13, priceC=2.11, priceD=23.13, priceE=74.56, priceF=1.11, priceG=9.34, priceH=3.45; cout<<"Thank You! Your order is summarized below: "<<endl; cout<<"-----------------------------------------------"<<endl; cout<<"| Product\t|Quantity\t|Line total |"<<endl; cout<<"-----------------------------------------------"<<endl; while (getline(inpfile, fline)) { istringstream ists(fline); string product; int quantity; if (!(ists >>product>> quantity)) {…arrow_forwardSUBJECT NAME IS C++: WAP to read 4 student objects and write them into a file, then print total number of student number in file. After that read an integer and print details of student stored at this number in the file using random access and file manipulatorsarrow_forwardC++: 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_forward
- 4. Write a C++ code that: 1. Read the sequences in the provided fasta file (unzip the attached file) 2. Build a Kmer count table (use array) where k = 10%; 3. Build a histogram table of size 200 in which we store the frequency of counts collected in step 2. if frequency is 200 or more, increment the last element in the histogram array. 4. Report the results of histogram table to screen as the following: Kmer-Count Frequency 1 100 80 3 40 20 .... 200 300arrow_forwardC++ void print_stats(string filename); Notes: 1. Already a text file with the number of wins and switches from 10,000 games is made. 2. The function reads information from a text file that has recorded a simulation of a set of games. 3. The output generated is from a file called stats_large.txt from 10,000 computer vs computer games. Parameters: Filename: the file contains the following information in order: • The number of games played • Followed by the given number of this tuples of (0,1) each separated by a space: 0. The first number of this tuple is 1 for a winner game, o for a non winner game. 1. The second number of this tuple is 1 for the player having switched their choice, 0 if they did not switch Return: Prints the statistics for a series of "Let's Make a Deal" outcomes. The information is printed to the console in the following format: Statistical analysis of Let's Make a Deal Game In ***** games : Number of switch decisions: **** Number of wins when switching: ****…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_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning