----------------------------------- Egyptian Mafia Mon May 10, 2004 8:23 pm 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 :) ----------------------------------- Delos Mon May 10, 2004 8:58 pm ----------------------------------- http://www.compsci.ca/v2/viewtopic.php?t=4540 The Search button sometimes is useful for this forum! Really! Hmm...you may need this too: http://www.compsci.ca/v2/viewtopic.php?t=5 ----------------------------------- Egyptian Mafia Mon May 10, 2004 9:11 pm ----------------------------------- 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 Mon May 10, 2004 11:32 pm ----------------------------------- 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 Tue May 11, 2004 3:48 pm ----------------------------------- 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: 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. ----------------------------------- Egyptian Mafia Tue May 11, 2004 3:58 pm ----------------------------------- Hacker Dan, do you have MSN Messenger. add me please egyptianmafia@hotmail.com So i can tell u what exactly what i want to do. Thanks a lot :) ----------------------------------- Egyptian Mafia Tue May 11, 2004 4:12 pm ----------------------------------- 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! :cry: 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 Tue May 11, 2004 6:31 pm ----------------------------------- First, let's clean up some errors: get: stremin, "data.t" should read something like: get: stremin, aVarInWhichToStoreTheStuffGottenFromTheStream obviously, with a shorter name for the second variable. Then: totalInStringFormat += aVarInWhichToStoreTheStuffGottenFromTheStream Notice that 'totalInStringFormat' is indeed in string format. It would be impossible to assign the value of 'T' or 'A' or even 'F' to an int variable. numberofmarks += 1 The prog WILL crash here unless you instantiate (that is to say, initialize) the variable before it gets here. i.e. var numberofmarks : int := 0 That's for now. Press F2. Fix that, get some more code done, and then we'll see what's next. ----------------------------------- Egyptian Mafia Tue May 11, 2004 8:06 pm ----------------------------------- Thanks man, I will work on it now and I will post the program with the new code. :) ----------------------------------- Egyptian Mafia Tue May 11, 2004 8:42 pm ----------------------------------- Ok, i put in the codes and yea...they dont work...I dont know if i put them in right or wrong.... :?: Thanks :) The progggie is attached here... ----------------------------------- Delos Tue May 11, 2004 9:10 pm ----------------------------------- Dude...seriously. That whole excessively lenghty named variable was a touch of sarcasm. You need to declare variables before they can be used you know... And you still havn't quite got the concept of 'get:'ing. It's: get : fileStream, varForStorage I hope you understand such syntaxial expansions. Now...try again... ----------------------------------- Egyptian Mafia Tue May 11, 2004 10:19 pm ----------------------------------- Delos, could you please post the code in the program and attach it. I seriousily did everything you told me but it does not work. Thanks man :) ----------------------------------- Egyptian Mafia Wed May 12, 2004 12:35 pm ----------------------------------- Guys, how about this...I worked really hard on this version here. I just need to finish up the proggie...Could someone please help me finish it Thanks :) proggie attached! ----------------------------------- Egyptian Mafia Wed May 12, 2004 3:02 pm ----------------------------------- Guys, I really need your help...This is due very soon. Thanks :) ----------------------------------- Delos Wed May 12, 2004 3:54 pm ----------------------------------- Errors: 1) eg. if mark >=80 and