122 homework week 2 |
The assignmentUse Emacs to edit/compile/execute/debug a C++ program that solves problem 25, p. 89. Name the source file commas.cpp. Name the executable commas (using the g++ switch -o commas ). Note that the required for loop is explained in 3.8 of your text, not 3.9 as stated on p. 89. Simplifying Assumptions:
I/O specificationYour program should generate this interface (see p. 57):How many numbers? 2 Enter number 1: 2306 2036 with commas is -2,306 Enter number 2: 1234567890 1234567890 with commas is 1,234,567,890 Exiting... Creating Files Using Unix I/O RedirectionHere is a tutorial about IO redirection, however you may be able to get by with the following tips until next week. Use Emacs to create a file commas.in that will contain the inputs necessary to run your program (e.g., 2 2306 1234567890). Then use Unix I/O redirection to create an output file by using this
shell-level command: Note: if commas.out already exists you can overwrite it with this
shell command: You can examine the file using this shell command: |