Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an input file with nano lab04bin.txt 12 123 1234 12345 123456 1234567 12345678 123456789 Implementation Detail 1 : Remember that an integer divided by

Create an input file with nano lab04bin.txt

12

123

1234

12345

123456

1234567

12345678

123456789

Implementation Detail 1: Remember that an integer divided by an integer is of type integer. Make sure you use at least one decimal point in your division (like 1.0/9) or double(numerator)/denom

Implementation Detail 2: The default for the cout of a double is 5 places of accuracy. If you want to increase that you would use setprecision. Use setprecision (20)

my teacher wants us to implement above details to this program below:

#include

#include

using namespace std;

int main()

{

ifstream infile("in.txt");

ofstream outfile("out.txt");

bool done = false;

int menu = 3, item;

cout << "Your Name\tYour ID ";

while (!done)

{

cout << "1. Read from and write to file ";

cout << "2. Exit ";

cin >> menu;

switch (menu)

{

case 1:

while (infile >> item)

{

cout << "number:" << item << endl;

for (int i = 1; i < 5; i++)

{

cout << item + i << "\t";

outfile << item + i << "\t";

}//for

cout << endl;

outfile << endl;

}//while

infile.close();

outfile.close();

cout << "done. ";

break;

case 2:

done = true;

break;

default:

break;

}//switch

}//while

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

11.9 Graphical Analysis

Answered: 1 week ago