Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!