Sie sind auf Seite 1von 2

CSCE 121 HOMEWORK 1

Section: _____100______
Due: 11:59 P.M. Monday, June 8, 2015
"On my honor, as an Aggie, I have neither given nor received any
unauthorized aid on any portion of the academic work included in this
assignment."
_______Joshua Mashburn_________ ________________________________
Typed or printed name of student
Signature of student
NOTE: Please follow your lab instructor's directions for submitting
your assignment through CSNET. ONLY ASSIGNMENTS SUBMITTED TO CSNET WILL
BE GRADED! Make a printout of each source file and staple it behind
this cover sheet, unless your lab instructor directs otherwise. Sign it
and give it to your TA in lab or put it in your TA's mailbox in the
corner of the 3rd floor of HRBB, near room 312. IF YOU DO NOT TURN IN A
SIGNED 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 and
execute 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, variable
names, comments, etc.), syntax (no compilation or link errors), and
correctness (passes all test cases). Follow the style guide at
http://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
/10
Grand total _____/50
1. (10 points) Pick 15 terms from the glossary which follows Appendix E in the
textbook and make a completed crossword puzzle by interlocking the words. List
the definitions as the clues. For example, here is a small crossword puzzle:
DOWN 2. starting function
ACROSS 1. add to
1

2
I N C R E M E N T
A

I
N
Note: 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 not
turn in the completed crossword puzzle; running your program will display it
on the screen.
Hint: Use 1/4-inch graph paper to lay out your completed crossword puzzle. You
can print your own at http://www.printfreegraphpaper.com.
2. (20 points) Exercise 10 on page 86, but with the following
modifications: instead of writing the operator followed by two operands,
your program should read an operand, an operator as a single character +-*/, and
another operand, separated by spaces. Also, after printing the result, go back
and read another arithmetic expression. Name your program hw1pr2.cpp.
For example, your program should accept these inputs:
100 + 3.14
4 * 5
To 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.00000
square root of (10 squared) is 10.0000
square 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 here
x *= 10;
with some sort of counter (while loop or for statement). The program should
produce 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.

Das könnte Ihnen auch gefallen