Click here to Skip to main content
15,903,201 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: HI ALL Pin
johnzfrebbies@28-Apr-08 15:03
johnzfrebbies@28-Apr-08 15:03 
GeneralRe: HI ALL Pin
David Crow29-Apr-08 3:36
David Crow29-Apr-08 3:36 
GeneralRe: HI ALL Pin
johnzfrebbies@29-Apr-08 15:35
johnzfrebbies@29-Apr-08 15:35 
GeneralRe: HI ALL Pin
73Zeppelin28-Apr-08 22:02
73Zeppelin28-Apr-08 22:02 
GeneralRe: HI ALL Pin
johnzfrebbies@29-Apr-08 15:27
johnzfrebbies@29-Apr-08 15:27 
QuestionRe: HI ALL Pin
David Crow29-Apr-08 16:32
David Crow29-Apr-08 16:32 
AnswerRe: HI ALL Pin
johnzfrebbies@29-Apr-08 16:42
johnzfrebbies@29-Apr-08 16:42 
AnswerRe: HI ALL Pin
73Zeppelin29-Apr-08 20:21
73Zeppelin29-Apr-08 20:21 
Okay, your code seems correct. To be sure, I copied and compiled your program. For input I used the text file C:\driversexam.dat containing the numbers 1 to 20 and then in Answers.dat I also put the numbers 1 to 20, but I mixed a few up to simulate incorrect answers (Note: this will work with both numbers and characters).

It seems to work correctly.

Here is the output:
                        THESE ARE YOUR RESULTS.
Question 1
 Was answered correctly.
Question 2
 Was answered correctly.
Question 3
4 is an incorrect choice.
Question 4
3 is an incorrect choice.
Question 5
 Was answered correctly.
Question 6
 Was answered correctly.
Question 7
 Was answered correctly.
Question 8
 Was answered correctly.
Question 9
 Was answered correctly.
Question 10
 Was answered correctly.
Question 11
 Was answered correctly.
Question 12
 Was answered correctly.
Question 13
 Was answered correctly.
Question 14
 Was answered correctly.
Question 15
 Was answered correctly.
Question 16
 Was answered correctly.
Question 17
 Was answered correctly.
Question 18
 Was answered correctly.
Question 19
 Was answered correctly.
Question 20
 Was answered correctly.
                        You answered 18 questions correctly.
                        You answered 2 questions incorrectly.

                        CONGRATUATIONS!
              YOU HAVE PASSED THE DRIVER'S LICENSE TEST.
                      DON'T DRINK AND DRIVE
Press any key to continue . . .


So it seems to work. Have you placed driversexam.dat and Answers.dat in C:\? You've hard-coded the directory structure, so make sure you have the files to be read in the right location. If not, maybe you could provide some more description regarding the problem.
GeneralRe: HI ALL Pin
johnzfrebbies@30-Apr-08 2:06
johnzfrebbies@30-Apr-08 2:06 
GeneralRe: HI ALL Pin
David Crow30-Apr-08 3:08
David Crow30-Apr-08 3:08 
AnswerRe: HI ALL Pin
73Zeppelin30-Apr-08 3:19
73Zeppelin30-Apr-08 3:19 
AnswerRe: HI ALL Pin
johnzfrebbies@29-Apr-08 16:43
johnzfrebbies@29-Apr-08 16:43 
GeneralRe: HI ALL [modified] Pin
73Zeppelin29-Apr-08 20:02
73Zeppelin29-Apr-08 20:02 
GeneralRe: HI ALL Pin
johnzfrebbies@30-Apr-08 11:28
johnzfrebbies@30-Apr-08 11:28 
AnswerRe: HI ALL Pin
73Zeppelin1-May-08 0:11
73Zeppelin1-May-08 0:11 
GeneralRe: HI ALL Pin
johnzfrebbies@1-May-08 8:32
johnzfrebbies@1-May-08 8:32 
GeneralRe: HI ALL Pin
73Zeppelin1-May-08 9:08
73Zeppelin1-May-08 9:08 
GeneralRe: HI ALL Pin
johnzfrebbies@1-May-08 18:49
johnzfrebbies@1-May-08 18:49 
GeneralRe: HI ALL Pin
73Zeppelin2-May-08 22:06
73Zeppelin2-May-08 22:06 
QuestionCan someone who is good at math please check my working!? - Differential equation [modified] Pin
MarkB77722-Apr-08 3:58
MarkB77722-Apr-08 3:58 
AnswerRe: Can someone who is good at math please check my working!? - Differential equation Pin
73Zeppelin22-Apr-08 4:09
73Zeppelin22-Apr-08 4:09 
GeneralRe: Can someone who is good at math please check my working!? - Differential equation Pin
MarkB77722-Apr-08 4:18
MarkB77722-Apr-08 4:18 
AnswerRe: Can someone who is good at math please check my working!? - Differential equation Pin
73Zeppelin22-Apr-08 4:15
73Zeppelin22-Apr-08 4:15 
GeneralRe: Can someone who is good at math please check my working!? - Differential equation Pin
MarkB77722-Apr-08 4:22
MarkB77722-Apr-08 4:22 
AnswerRe: Can someone who is good at math please check my working!? - Differential equation Pin
CPallini22-Apr-08 4:20
mveCPallini22-Apr-08 4:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.