hw 1 - 15 summer

Download hw 1 - 15 summer

If you can't read please download the document

Upload: scootertchn

Post on 06-Nov-2015

11 views

Category:

Documents


1 download

DESCRIPTION

csce 121 tamu c++ homework assignment 1

TRANSCRIPT

CSCE 121 HOMEWORK 1Section: _____100______ Due: 11:59 P.M. Monday, June 8, 2015"On my honor, as an Aggie, I have neither given nor received anyunauthorized aid on any portion of the academic work included in thisassignment."_______Joshua Mashburn_________ ________________________________Typed or printed name of student Signature of studentNOTE: Please follow your lab instructor's directions for submittingyour assignment through CSNET. ONLY ASSIGNMENTS SUBMITTED TO CSNET WILLBE GRADED! Make a printout of each source file and staple it behindthis cover sheet, unless your lab instructor directs otherwise. Sign itand give it to your TA in lab or put it in your TA's mailbox in thecorner of the 3rd floor of HRBB, near room 312. IF YOU DO NOT TURN IN ASIGNED COVER SHEET YOUR WORK WILL NOT BE GRADED!NOTE: Homework will be graded on build.cse.tamu.edu using g++ -std=c++14.You are free to develop your programs on Visual C++ or any other platform, but it is your responsibility to make sure your programs also compile andexecute correctly on build.cse.tamu.edu using g++ -std=c++14.NOTE: Each file submitted (hw1pr1.cpp, etc.--see below) must begin as follows://Your Name//CSCE 121-xxx (fill in your section number)//Due: June 8, 2015 (or whatever the due date is)//hw1pr1.cpp (or whatever this file name is)The grade for this lab will be based on style (formatting, variablenames, comments, etc.), syntax (no compilation or link errors), andcorrectness (passes all test cases). Follow the style guide athttp://www.stroustrup.com/Programming/PPP-style.pdf. Your grade for this lab is:Problem # 1 2 3 4 Style /2 /4 /4 /2 Syntax /3 /6 /6 /3 Correctness /5 /10 /10 /5-------------------------------------------------------------------Total /10 /20 /20 /10Grand total _____/501. (10 points) Pick 15 terms from the glossary which follows Appendix E in thetextbook and make a completed crossword puzzle by interlocking the words. Listthe definitions as the clues. For example, here is a small crossword puzzle:DOWN 2. starting functionACROSS 1. add to1 2 I N C R E M E N T A I NNote: Use the computer science definitions given in the glossary, not the ordinary non-technical definition. Now write a C++ program named hw1pr1.cpp which prints the clues and the puzzle using lots of cout statements. Do notturn in the completed crossword puzzle; running your program will display iton the screen.Hint: Use 1/4-inch graph paper to lay out your completed crossword puzzle. Youcan print your own at http://www.printfreegraphpaper.com.2. (20 points) Exercise 10 on page 86, but with the followingmodifications: instead of writing the operator followed by two operands,your program should read an operand, an operator as a single character +-*/, andanother operand, separated by spaces. Also, after printing the result, go backand read another arithmetic expression. Name your program hw1pr2.cpp.For example, your program should accept these inputs: 100 + 3.14 4 * 5To make it go back and read another arithmetic expression, use this code:while(cin >> left >> operation >> right)(This will be false when the user types Contol-D on Unix or Control-Z on Windows.)3. (20 points) Exercise 11 on page 86. Do not worry about making the"improvements" listed for now. Name your program hw1pr3.cpp.OPTIONAL EXTRA CREDIT =====================4. (10 points) Write a C++ program which prints 11 lines of this table:square root of (1 squared) is 1.00000square root of (10 squared) is 10.0000square root of (100 squared) is 100.000...by adding lines to this code:auto x = 1;auto x2 = x * x;auto y = sqrt(x2);//cout goes herex *= 10;with some sort of counter (while loop or for statement). The program shouldproduce some strange values (why?), so after printing the table also print"This program produced some strange values since..." (fill in your reason). Name your program hw1pr4.cpp.