Posted: Mon May 10, 2004 8:23 pm Post subject: True and False Program
Ok, I need to make a true and false program. The program has a student id # and an answer string of each student. for example
ID # 0080 he answered FTTFTFTTFT
ID # 0340 he answered FTFTFTTTFF
.....
So I need to make a data file which stores the correct answer which is FTFFTFFTFT which I already done. I have started the program but i am stuck on which I should do next. I also need to give grades according to the percentage of the correct answer so A is Best 1 pr Best -1 and B if Best -2 and C for Best-3 and Give F for failures.
I am going to attach both the program i made which i started and the data file that includes the correct answer. I need please someone who is generous enough to put me on the right track and just add a few lines or show me the codes to what i should put next. Once again, i am an extreme n00b.
Thanks
EDIT: I Changed the exam.t with the new code i got from the tutorial and still it does not work. Please check it out.
Thanks
exam.t
Description:
I looked at the tutorial posted in the links but the program tells me stuff is illegal?!!!
Posted: Mon May 10, 2004 9:11 pm Post subject: (No subject)
Please check re-attached exam.t with the new code entered from the tutorial, i copied it and it still not working.
Thanks
Egyptian Mafia
Posted: Mon May 10, 2004 11:32 pm Post subject: (No subject)
Come on guys, I am not asking for you guys to make me the proggie. I just need few codes to get me started from where i stopped. Please...
Thanks
Dan
Posted: Tue May 11, 2004 3:48 pm Post subject: (No subject)
Well u may whont to read the tutorial a litte closer.
U use "data.t" as if was a varibale but it is not, it is a string. Also you are then trying to add a string value to a int witch dose not work.
Also i dont understand how you are trying to conver a line of Fs and Ts to a number. All u do is add the string to total and then have a var caled marks withc u check but never set.
i could help but i do not fully understand what you are trying to do. Where are the sutdtends aswers coming from (file or user input and what file if it is a file) and where is the output going(file or screen and what file and in what form)? is the answer the only thing it the data file? and will it allways be the only thing in that file? if so then you do not need to use a loop to get the input and just need one get stament like this:
code:
var stremin :int
open: stremin, "data.t", get
var line : string
get: stremin, line
close:stremin
and the line of F and T will be in the var line. then u just need to uses substrings in a for loop to check the anwers agested the right one.
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Egyptian Mafia
Posted: Tue May 11, 2004 3:58 pm Post subject: (No subject)
Hacker Dan, do you have MSN Messenger. add me please
Posted: Tue May 11, 2004 4:12 pm Post subject: (No subject)
Here is the exact question... it is long...so bare with me...
Write a program that first reads in the answer strings representing the 10 correct answers ( use FTFFTFFTFT as data) Next, for each student, read the students's data and compute and store the number of correct answers for each student in one array. Determine the best score, Best. Then print a three column table displaying the ID number, score and grade for each student. The grade should be determined as follows : If the score is equal to Best or Best-1, give A; if it is Best-2 or Best-3, give C. Otherwise, give an F. then , Modify the test scoring program developed for programming the first project to allow for multiple-choice questions having answers A through E. Compute the average number of correct answers, the range of scores ( that is, largest number correct to smallest number correct), and the average of the grades assigned ( use the grade point equivalencies) A=4.0, C=2.0 and F=0.0
Boy, am i screwed. This program maybe so easy for you guys but to me it is HELL! I seriousily dont know what i am doing. All i know is what i made in the proggie i attached. I am SOL! Please help me.
Thanks a lot.
Delos
Posted: Tue May 11, 2004 6:31 pm Post subject: (No subject)
Posted: Wed May 12, 2004 3:02 pm Post subject: (No subject)
Guys, I really need your help...This is due very soon.
Thanks
Delos
Posted: Wed May 12, 2004 3:54 pm Post subject: (No subject)
Errors:
1)
eg.
code:
if mark >=80 and <100 then
That will not work. Sorry to say this, but do you ever actually run your programmes before posting them? Because if you're going to post something, at least try and fix as many errors as you can - especially ones like these...(if you genuinely don't understand the error, then don't worry)...anyway, on with the business.
You can't code the way you talk. Got that? So, you can't say "if the mark is greater than or equal to 80 and less than 100 then". Computers are stupid. Keep that in mind. Instead, say "if the mark is greater than or equal to 80 and the mark is less than 100 then".
i.e.
code:
if mark >=80 and mark <100 then
*************
2.
code:
for x : 1 .. 10
get : stream, ans1 (x)
end for
I take it you have no idea what the 'get :' command does. Or at least a very small one.
'get :' reads an entire line from a file. So, for looping this 10 times means that it will try to get 10 lines! But as you know, there is only 1 line in your data.t file.
So, do one of two things:
- in data.t, make sure that there are 10 lines. Instead of "TFTTTFFTFF", have it as:
T
F
T
...
that way you'll have 10 lines, and each line will go into the right element in your array.
- or you could only have 1 line, read that line from the file (without a for loop), and then with a for loop divide it up into 10 seperate letters, which you'd then store into your array.