Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 true/false test program help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
newprogrammer007




PostPosted: Thu Apr 15, 2004 2:19 pm   Post subject: true/false test program help

Hi.. i been sick for 2 weeks and my teacher sent me this program to do and i dont know how to do anything with arrays i found this site and been reading the tutortial it has helped a lot but i am on this last program and i need to have it completed. My teachers a jerk he didnt send any notes to class and just sits there eating lunch all day. And we have no txbooks so that doesn't help anyways here what i have to do if anyone could help it would help a lot Very Happy

Create a program that will calculate an unknown number of student marks on a true/false quiz The input for the program should come from a data file you create:

A sample of the data in the data file is shown below:
T F T T T F F T F T
RYAN T F T T T F F T F T
Brian T F T T T F F T F F
Chris T T T T F F F T T T
Dan T F F T F F F T T

The first line of the data file represents the correct answers to the 10 ture/false questions. Each students mark should be calculated by comparing his or her answer to the corresponding question's correct answer. The students responses and the correct answers should each be stored in an array. It is not necessary to store the student's name and their percentage on the test. In addition the program should calculate and output the class average on the test.

I don't know if the sickness is getting to me or what but that makes no sense to me please help.. thanks
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Thu Apr 15, 2004 4:24 pm   Post subject: (No subject)

I'm assuming from your post that you know how to handle files.
Good.

Now:
- read in the file.
- figure out what goes where...the first line contains the answers. Perhaps put that into an array of its own (you'll know how to do this from the Tutorials).
To streamline things, use a flexible 2-dimensional array, set at a standard width of 10.
Sorry. Didn't mean to do that. Probably a tad too advanced. Ok...just set up a bunch of arrays, probably 4 or 5, one for each student.
- read all the relevant data into a temporary string variable.
- sort out the data, and dump what is needed into the arrays.
- now, comparison time! Compare each element in the students' arrays with the corresponding element in the answers array.
- calculate the total, average, etc, etc, store that to a variable.
- you may want to display the marks for each student/store them/write them to disk as well later.
- once all marks are calculated, find the average...simple maths.
- write all relevant data back to disk.

Easy, eh?
newprogrammer007




PostPosted: Fri Apr 16, 2004 2:35 pm   Post subject: (No subject)

just to confirm so i need to use stream number???
Tony




PostPosted: Fri Apr 16, 2004 7:56 pm   Post subject: (No subject)

unless you know of another way to access data from a file Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: