CSCE 121 HOMEWORK 1 solved


Category: You will receive a download link of the .ZIP file upon Payment


5/5 - (1 vote)

1. (10 points) There is no Nobel Prize in computer science, but there is the
Turing Award by the Association for Computing Machinery. Posters of all the
Turing Award winners are in the halls of the buildings used by the Department
of Computer Science and Engineering, namely, the 2nd, 3rd, 4th, 5th floors of
HRBB, the 2nd and 3rd floors of Teague, and Reed McDonald. Visit these
locations and write down 15 Turing Award winners’ last names and the nearest
room number, then make a completed crossword puzzle on paper by interlocking the
last names. List the room numbers as the clues. For example, here is a
small crossword puzzle using Frederick Brooks and Donald Knuth:

DOWN 2. Teague 326 (Note: This is an example, not the correct room number)

ACROSS 1. HRBB 312 (Note: This is an example, not the correct room number)

1 2





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 like the example above,
except yours will have 15 names.

Hint: Use 1/4-inch graph paper to lay out your completed crossword puzzle on
no more than 24 rows of no more than 80 columns each. You can print your own
graph paper at

2. (20 points) With one cut across the middle of a pizza you can cut off half, that is, 50% of the pizza. With one cut at a different place you can cut off
less than 50%. The length of the cut is called the “chord” and the piece
removed is called the “segment.”

Look up (or derive yourself) the formula for the area of a segment in terms of
the chord length and the diameter, and write a C++ program to ask for the chord
length in inches and print out the percentage of a 14″ pizza remaining after the
segment is cut off. Running your program should look like this:

Pizza diameter is 14″.
Enter chord length in inches: 0
That cut leaves 100% of the pizza.
Enter chord length in inches: 14
That cut leaves 50% of the pizza.
Enter chord length in inches: 10.17
That cut leaves 90% of the pizza.

Use while(cin >> chord) so the program will keep reading and calculating until
end of file. Name your program hw1pr2.cpp. Reminder: If you did not derive
the formula yourself, state in a comment where you got the formula.

3. (20 points) Chapter 4 Exercise 8, using int. Name your program hw1pr3.cpp.

4. (10 points) Modify problem 3 to print the exact number of grains on all 64
squares. Use unsigned long long instead of int. (Note: This works on our
two compilers, but may not work on other C++ compilers.) Name your program