(takes input in the form of one grade, lower case, per line.)%g=("a"=>4, "b"=>3, "c"=> 2, "d"=>1, "f"=>0, "+"=> 1/3 , "-"=> -1/3); while (<>){ chomp; next unless m/^([abcdf])([+-])?$/; $n+=1; $t+= $g{$1}; m/(a\+|f-)/ or $t+=$g{$2};} print($t/$n,"\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: gpa.pl
by ColonelPanic (Friar) on Aug 23, 2000 at 23:02 UTC |