CISC 105 Lab 05 FAQ
For each of the following questions, I'll give suggestions for
"troubleshooting" the problem.
Notes from Sara:
COMMENTS! You should include high-level descriptions for both
your programs and your functions.
Refer to the
coding standards to educate yourself on what we expect of your code.
ALIGN CODE and HAVE GOOD STYLE. I'm taking off mucho points
for code that's hard to read. You have had plenty of warning.
I did number 7 when I wrote 6. What should I do?
6 is an intermediate step to writing 7. (For 6, all output is in the
main. For 7, all I/O is in the main.) I will grade 6 and 7 together.
If you did #7 (without doing #6), that's fine. Just mark in your
files that that you combined 6 and 7.
Note: If you mess up on 7 and didn't attempt the
intermediate step (6), you will be penalized more heavily. I'd rather
have a working version of 6 than only a broken version of 7.
lab05.5.c: I don't see how you can make it so that the mod (%)
gives accurate values for all widths and heights.
Look at Lab 4.2 and figure out how to generalize it.
lab05.6.c: What exactly is a sentinel combination?
You want to say something like stop the loop when all three inputs are
-1. The "combination" is that all three inputs meet some criteria.
lab05.8.c: What are flags? Professor Harvey wants us to use them
for the last part of the lab and we didn't learn them yet.
You need something that says "This value is not a prime" so stop
looking for factors. You'll probably want a variable to switch "on"
and "off" depending on if the value was already found to be composite
lab05.8.c: Can you explain the output that you're looking for in the primes problem?
What I'm looking for is something like...
2 is not a factor of 17
3 is not a factor of 17
4 is not a factor of 17
16 is not a factor of 17
17 is prime!
Then, Harvey's suggestion of reducing the number of possible factors to
reduce the amount of output makes more sense.
Also, you can stop looping when you find the first factor of a number.
2 is not a factor of 9
9 is not a prime: 3 and 3 are factors of 9.