CISC 105 Lab 08 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.
How do I run gnuplot?
Type gnuplot [name_of_gnuplot_cmds_file]
.
For the first gnuplot we need to do with the number of days in
each month, I can't get the title _Num of Days to come down to the
bottom of the picture like in the example. It is stuck at the top. Do
you know what I did wrong?
It may be the system that I created the plot on has different
defaults. If you add
set key below
to the gnuplot commands script, it should work.
Could you give me a hint on how to start counting how many times
I generate a number?
So, the array starts at all 0s. You start generating random numbers.
If you generate, say, a 3. You want to add 1 to the array at index 3.
If you generate a 5, you want to add 1 ot the array at index 5, etc.
Are we supposed to write a program in C that actually generates
the data files?
Yes, write a C program to do it. You already generated the output in
program 0. Now, you want to put the output in the appropriate gnuplot
data format in a file. You may need to look in your book about how to
write data to files.
Is it okay if I have one program for creating the data file and
simply change the constants and create a new data file for each new
set of random numbers or do I need to do all four in the same
program?
Either way is fine. If you go with the former, comment that you
changed the constant to generate the other data files.
I am having a hard time getting the title to appear on my gnuplot graphs for the random
numbers. The set key below command doesn't work. Should I just put the tile in the html
file where I put all four graphs or is there something I can change in the gnuplot file?
Does the title not show up at all or not in the right place? Maybe
your title is too long. Try something shorter (just "FC" for
frequency count, for now) to see what happens there. The key is
actually different than the title. The key is just a label for the the
lines (like "frequency count"); the title should be a little more
descriptive and mention how many total numbers were generated.
We put all 4 graphs on the one html page right? What about links
to get to these pages?
The title should also go in the HTML file. There should be 4 graphs
on one Web page. You don't need to link to the page. I'll be looking
for "http://copland.udel.edu/~userid/cisc105/lab08" If the web page
isn't there or isn't accessible, then there's trouble.
For part 2 program 0, you want us to generate 10 random numbers
and store them in an array?
No, the random numbers themselves are not stored in the array. The
array keeps track of the number of times each random number occurs,
i.e., the sum total of the final array should be 10 (or however many
numbers were generated).
Submission clarification: there should be one C Program
to submit if I'm reading right (it says submit 2).
There are two C programs to submit: Program 0 and Program 1 on the lab
description. Program 0 is an intermediate step to Program 1.
gnuplot clarification
There are three types of gnuplot files:
- command files: .gnuplot or .plot, etc.; contain the commands for generating a gnuplot output file
- data files: .dat files; contain the data that gnuplot will plot
- output files: .png (generated from running
gnuplot [cmds.gnuplot]