ENGR 112 HOMEWORK #2 Due: 11:59 P.M. Friday, September 15, 2006 NOTE: Please follow your lab instructor's directions for submitting your assignment to your ENGR 112 section on http://csnet.cs.tamu.edu. NOTE: Homework will be graded by how it runs on unix.cs.tamu.edu. You may develop and test your homework on any platform, but make sure it runs correctly on unix.cs.tamu.edu. NOTE: Begin each file according to the following sample-- // hw2pr1.cpp (assignment number and problem number) // // ENGR 112-5xx (your section number) // Due 11:59 P.M. Friday, September 15, 2006 // In support of the Aggie Honor Code, I have neither given nor received any // unauthorized help on this assignment. 1. (10 points) Do the drill in section 4.12. Turn in the final program as hw2pr1.cpp. 2. (10 points) Exercise 3 in section 4.14. Name your program hw2pr2.cpp. 3. (10 points) Write a C++ program named hw2pr3.cpp which reads a list of words (ending with QUIT) and determines whether or not the list is sorted (that is, in lexicographic order according to the ASCII character set). Hint: The list apple orange tangerine QUIT is in lexicographic order, but the list deLeon deMorgan DeSoto QUIT is not. 4. (10 points) Exercise 6 in section 4.14. Name your program hw2pr4.cpp. Hint: See exercise 5 in section 4.14. OPTIONAL EXTRA CREDIT ===================== 5. (5 points) Write a C++ program named hw2pr5.cpp to calculate exactly the total number of grains of rice for the entire chessboard (see exercise 3 in section 4.14). Hint: The answer should [barely] fit in an unsigned long long using g++ on unix.cs.tamu.edu, although it might not on other compilers.