int main (){...}0. Create a project directory for this lab. Copy thefile lab03-input.txt located in the/home/shared/cs135/kmess/ directory toyour project directory.1. Write a statement that...


Problem Description<br>Consider the following incomplete C++ program:<br>// a comment with your name and your lab<br>#include <iostream><br>int main ()<br>{<br>...<br>}<br>0. Create a project directory for this lab. Copy the<br>file lab03-input.txt located in the<br>/home/shared/cs135/kmess/ directory to<br>your project directory.<br>1. Write a statement that includes the header<br>files fstream, string, and iomanip in this<br>program.<br>2. Write statements that declare infile to be an<br>ifstream variable and outfile to be an<br>ofstream variable.<br>3. The program will read data from the file lab03-<br>input.txt and write output to the file<br>output.txt. Write statements to open both<br>files, associate infile with lab03-input.txt,<br>and associate outfile with output.txt.<br>4. Suppose that the file lab03-input.txt contains<br>the following data:<br>

Extracted text: Problem Description Consider the following incomplete C++ program: // a comment with your name and your lab #include int main () { ... } 0. Create a project directory for this lab. Copy the file lab03-input.txt located in the /home/shared/cs135/kmess/ directory to your project directory. 1. Write a statement that includes the header files fstream, string, and iomanip in this program. 2. Write statements that declare infile to be an ifstream variable and outfile to be an ofstream variable. 3. The program will read data from the file lab03- input.txt and write output to the file output.txt. Write statements to open both files, associate infile with lab03-input.txt, and associate outfile with output.txt. 4. Suppose that the file lab03-input.txt contains the following data:
4. Suppose that the file lab03-input.txt contains<br>the following data:<br>$ cat lab03-input.txt<br>Accounting Henry Block<br>6042.18 5 28<br>The first line contains the department a person<br>works in (one word), followed by the person's<br>given name and surname (two or more words).<br>In the second line, the first number represents<br>the monthly gross salary, the bonus (as a<br>percent), and the taxes (as a percent). Write<br>statements so that after the program executes,<br>the contents of the file output.txt are as<br>shown below in the sample interaction. If<br>necessary, declare additional variables.<br>Code to the specification: your statements<br>should be general enough so that if the<br>content of the input file changes and the<br>program is run again (without editing and<br>recompiling), it outputs the appropriate results.<br>5. Write statements to close the input and output<br>files.<br>6. Complete a C++ program that tests the<br>statements in steps 1-5 above. Output is<br>formatted into two columns. Set the width of<br>column 0 to 16. All output is left aligned.<br>Sample Interaction<br>5. Write statements to close the input and output<br>files.<br>6. Complete a C++ program that tests the<br>statements in steps 1-5 above. Output is<br>formatted into two columns. Set the width of<br>column 0 to 16. All output is left aligned.<br>Sample Interaction<br>$ ruler<br>1<br>3<br>4<br>12345678901234567890123456789012345678901:<br>$ clang++ -std3Dc++14 -Weverything lab03.cj<br>$ ./a.out<br>Done.<br>$ cat output.txt<br>Name:<br>Department:<br>Net Pay:<br>Henry Block<br>Accounting<br>$4567.89<br>Note: The ruler utility displays an 80-column ruler<br>to help you count spaces and align your output.<br>

Extracted text: 4. Suppose that the file lab03-input.txt contains the following data: $ cat lab03-input.txt Accounting Henry Block 6042.18 5 28 The first line contains the department a person works in (one word), followed by the person's given name and surname (two or more words). In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent). Write statements so that after the program executes, the contents of the file output.txt are as shown below in the sample interaction. If necessary, declare additional variables. Code to the specification: your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results. 5. Write statements to close the input and output files. 6. Complete a C++ program that tests the statements in steps 1-5 above. Output is formatted into two columns. Set the width of column 0 to 16. All output is left aligned. Sample Interaction 5. Write statements to close the input and output files. 6. Complete a C++ program that tests the statements in steps 1-5 above. Output is formatted into two columns. Set the width of column 0 to 16. All output is left aligned. Sample Interaction $ ruler 1 3 4 12345678901234567890123456789012345678901: $ clang++ -std3Dc++14 -Weverything lab03.cj $ ./a.out Done. $ cat output.txt Name: Department: Net Pay: Henry Block Accounting $4567.89 Note: The ruler utility displays an 80-column ruler to help you count spaces and align your output.
Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here