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_x
- : Real;
-
- {string variables follow:}
- dummy_s {string, may be deleted}
- ,A_R_x
- : 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_x);
- Close(OldQuestionFile);
- END
- else {there was no .SAV file, must generate new values}
- BEGIN
- {question creation section
- creating new values for student variables}
-
- R_x := -0.366;
- ReWrite(OldQuestionFile);{ create the .SAV file just in case
- student needs to quit and do it again}
- WriteLn(OldQuestionFile,R_x);
- Close(OldQuestionFile)
- END;
-
-
- STR(R_x:4:2,A_R_x);
- Trim_fore_aft(A_R_x);
-
- question := '';
- question2 := '';
- question := question + ' The integral from 30 degrees to 60 degrees of sin(x)cos(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 integrate from pi to zero?';
- END;
-
- If MaxAvail < Sizeof(Wrong_Answers) then
- BEGIN
- WriteLn('Not enough memory');
- Noise(Bad);
- halt;
- END ELSE
- BEGIN
- New(GenTempPtr);
- TempPtr^.next := GenTempPtr;
- TempPtr := GenTempPtr;
- TempPtr^.next := nil;
- TempPtr^.value := 2;
- TempPtr^.remark := 'Did you integrate from zero to pi?';
- END;
-
- true_answer := R_x;
-
- {$IFDEF Watch_Student}
- WriteLn(Outfile,Time_Stamp);
- WriteLn(OutFile,question);
- WriteLn(OutFile,'R_x = ',R_x);
- WriteLn(OutFile,'answer = ',R_x);
- {$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_x = ' + A_R_x;
- 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_x = ' + A_R_x;
- END;
- END {of .IN1};
-