CISC 105 Project 2 FAQ
For each of the following questions, I'll give suggestions for
"troubleshooting" the problem.
Professor Harvey's FAQ
The problem is some of the years are missing info and the number is
-99.9. Now if I average that it will really throw off my
numbers. What should I do?
Right, you know that -99.9 is not a "real" value, so you can ignore it
and not include it in the average. (Note that -99.9 is a magic
number, which means ... ???)
In the instructions it says that we can only read the data file
once to fill both arrays, does that mean we can only use one "fscanf"
or that we can only open and close the file once?
You can only open and close the file once.
For part 7, do we need to print out the name of the months for
each histogram, or are numbers (1=Jan 2=Feb) sufficient as long as we
include this in the comments and print this assignment to the user in
a printf.
I'd prefer if you printed out the months. I suggest a function called
"printMonth" that takes an integer and prints the appropriate month.
Should my menu be in a loop so the user can make multiple calls?
Yes.
For parts 3 and 6 of the project, do we need to have the array
print out?
Yes, it will be helpful to print out the array. I will look at the
code to make sure that you're also storing the array.
I put each part in a
separate program for now and will eventually move it all into one
program with the menu option. Do you want us to script all of our
little programs as well when we submit the lab on WebCT and on paper?
No, just submit the one, final program.
If all we need to do is store parts 3 and 6 of the
project, should we make a menu option for these options?
Yes, they should be menu options. You could print the stored data.
My function prototypes are very long in some cases. Is there any
way I can get the prototype to wrap to the next line in my C code so
that I don't lose points when I print my script once I am finished?
You can break your prototypes across multiple lines. Just do
something like
void doStuff( int a, int b,
int c, int d );
If you do esc-q in Emacs on one of those lines, does Emacs break it
up? If not, you can just do it manually. Thanks for thinking about
that. It will cause problems when I try to read your code.
My recommendations:
- If you're struggling to debug, add print statements. Many of the
problems that I'm seeing involve array access problems. Print out the
index variable to make sure it's what you expect. Also, print out the
data structures before you modify them to be sure that it looks as you
expect before you modify it.
- Use constants.
- For the histograms, print the data value out before printing the
stars so I know what value you're printing stars for.