home *** CD-ROM | disk | FTP | other *** search
- PROCEDURE Init_Question;
- VAR
- dummy_i {integer, may be deleted}
- {integer variables follow:}
- : Integer;
-
- {real variables follow:}
- dummy_r {real, may be deleted}
- ,R_minus_two
- : Real;
-
- {string variables follow:}
- dummy_s {string, may be deleted}
- ,A_R_minus_two
- : String;
-
- BEGIN
- {$I-}
- Assign (OldQuestionFile,Progname_string+'.SAV');
- Reset(OldQuestionFile);
- {$I+}
- IF IOResult = 0 THEN {this is a repeat, there was a .SAV file}
- BEGIN
- ReadLn(OldQuestionFile,R_minus_two);
- Close(OldQuestionFile);
- END
- else {there was no .SAV file, must generate new values}
- BEGIN
- {question creation section
- creating new values for student variables}
-
- R_minus_two := -2.;
- ReWrite(OldQuestionFile);{ create the .SAV file just in case
- student needs to quit and do it again}
- WriteLn(OldQuestionFile,R_minus_two);
- Close(OldQuestionFile)
- END;
-
-
- STR(R_minus_two:4:2,A_R_minus_two);
- Trim_fore_aft(A_R_minus_two);
-
- question := '';
- question2 := '';
- question := question + ' The integral from pi to zero of sin(x)dx is ? ';
-
-
- If MaxAvail < Sizeof(Wrong_Answers) then
- BEGIN
- WriteLn('Not enough memory');
- Noise(Bad);
- halt;
- END ELSE
- BEGIN
- New(RootErrorPtr);
- TempPtr := RootErrorPtr;
- TempPtr^.next := nil;
- TempPtr^.value := 2.;
- TempPtr^.remark := 'Did you do the integral backwards?';
- END;
-
- true_answer := R_minus_two;
-
- {$IFDEF Watch_Student}
- WriteLn(Outfile,Time_Stamp);
- WriteLn(OutFile,question);
- WriteLn(OutFile,'R_minus_two = ',R_minus_two);
- WriteLn(OutFile,'answer = ',R_minus_two);
- {$ENDIF }
-
-
- If MaxAvail < Sizeof(Debug_Lines) then
- BEGIN
- WriteLn('Not enough memory');
- Noise(Bad);
- halt;
- END ELSE
- BEGIN
- New(RootDebugLinePtr);
- TempDebugLinePtr := RootDebugLinePtr;
- TempDebugLinePtr^.next := nil;
- TempDebugLinePtr^.line := 'R_minus_two = ' + A_R_minus_two;
- END;
-
- If MaxAvail < Sizeof(Debug_Lines) then
- BEGIN
- WriteLn('Not enough memory');
- Noise(Bad);
- halt;
- END ELSE
- BEGIN
- New(GenTempDebugPtr);
- TempDebugLinePtr^.next := GenTempDebugPtr;
- TempDebugLinePtr := GenTempDebugPtr;
- TempDebugLinePtr^.next := nil;
- TempDebugLinePtr^.line := 'R_minus_two = ' + A_R_minus_two;
- END;
- END {of .IN1};
-