Parent Directory
|
Revision Log
Updated example files to use new features of parser and its answer checkers.
1 ########################################################## 2 # 3 # Example showing how to use the built-in answer checker for parsed values. 4 # 5 6 DOCUMENT(); # This should be the first executable line in the problem. 7 8 loadMacros( 9 "PGbasicmacros.pl", 10 "PGanswermacros.pl", 11 "Parser.pl", 12 ); 13 14 TEXT(beginproblem()); 15 16 ########################################################## 17 # 18 # The setup 19 # 20 21 Context('Numeric'); 22 23 $a = Real(random(2,6,1)); 24 $b = Real(random($a+1,$a+8,1)); 25 26 $c = sqrt($a**2 + $b**2); # still a Real object 27 28 ########################################################## 29 # 30 # The problem text 31 # 32 33 Context()->texStrings; 34 BEGIN_TEXT 35 36 Suppose the legs of a triangle are of length \($a\) and \($b\).$BR 37 Then the hypoteneuse is of length \{ans_rule(20)\}. 38 39 END_TEXT 40 Context()->normalStrings(); 41 42 ########################################################### 43 # 44 # The answer 45 # 46 47 ANS($c->cmp); 48 49 ########################################################### 50 51 ENDDOCUMENT(); # This should be the last executable line in the problem.
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |