CISC 105 Lab 07 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
C
coding standards to remind yourself 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. Name your variables and functions well.
You have had plenty of warning.
lab07.3.c: Are we supposed to compute the factorial for each
element in the array or just the factorial of 10?
Compute the factorial for each element in the array.
lab07.4, 5.c: What should we use as the size of the array?
A constant, of course! The constant should be large enough to
accomodate a wide range of input sizes. Demonstrate your code with
histograms of size 5 and 10.
lab07.4.c: are we supposed to use an array of size 3? Or are we
supposed to use an extremely large array?
Maybe not "extremely large" but "large enough", and you can stop the
user if they get carried away giving you input. (Just let them know
when they've gone too far.)
lab07.6.c: Can the arrays be two dimensional? Or do they have to
be one-dimensional?
Because of the function prototype, void printArray( int data[], int
dataSize );
, it has to be a one-dimensional array.
lab07.6.c: Do we need to get the arrays from the user?
No, you can just initialize the arrays (of different sizes) in the
program.
lab07.7.c: How are we supposed to open the file for part 7 of the
lab? Do we need to download it or do we put the web address for the
file's location?
Yes, download the file.
lab07.8.c: Note from Professor Harvey
In the lab I originally said to make a 10x10, and then a 10x20 array
and print it. If you already did that, fine.
If you did not, then make a 10x10 and a 20x10 instead, so that you can
use the same function to print them.
lab07.8.c: I get garbage results when I add the 20x10 array
You say "add" it, so you mean that you have both the 10x10 array and
the 20x10 array? The problem is that there are only 200 data values
in the file, but you want 300 to fill both the 10x10 array and the
20x10 array. After writing the 10x10 version, save a copy of the
program and then change the array to be 20x10 and make the other
changes to make the program work properly.
You will then just submit the 20x10 version of your program (unless
you can't get that version to work; then submit the working 10x10
version).
Alternatively, Professor Harvey added more data values to the data
file posted on the Web. You can use the new data file and then submit
a program that uses both the 10x10 and the 20x10 arrays to show that
your function works with either array size.
An older version of the data file is here.
lab07.9.c: The problem says the function takes an array of
size
doubles. Does that mean instead of NUM_DATA we use
DOUBLES as a constant? Or does it mean doubles as in 6.789
5.0000?
There are no constants (NUM_DATA, DOUBLES) directly associated with
the function. The prototype description says what parameters the
function should take: an array of doubles and the size of the array.