Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.60 and 1.63

version 1.60, 2002/09/30 18:08:09 version 1.63, 2002/10/01 20:17:42
Line 225  sub end_numericalresponse { Line 225  sub end_numericalresponse {
         if ($target eq 'web') {          if ($target eq 'web') {
     $result.= '<table border="1"><tr>';      $result.= '<table border="1"><tr>';
     for ($ind=0;$ind<$number_of_bubbles;$ind++) {      for ($ind=0;$ind<$number_of_bubbles;$ind++) {
  if (undef @formats) {   my $ans;
     my $ans = sprintf('%.'.$formats[0],$bubbles_values[$ind]);   if ($formats[0] ne '') {
     $result.='<td>'.$alphabet[$ind].': '.$ans.'</td>';      $ans = sprintf('%.'.$formats[0],$bubbles_values[$ind]);
  } else {   } else {
     my $ans = sprintf('%.'.'d',$bubbles_values[$ind]);      my $badans = $bubbles_values[$ind];
     $result.='<td>'.$alphabet[$ind].': '.$ans.'</td>';      my $format = ''; 
                       #What is the number? (integer,decimal,floating point)
                       if ($badans=~/^(\d*\.?\d*)(E|e)(\d*)$/) {
    $format = 'e'.$2;
       } elsif ($badans=~/^(\d*)\.(\d*)$/) {
    $format = '4f';
       } elsif ($badans=~/^(\d*)$/) {
    $format = 'd';
       }
       $ans = sprintf('%.'.$format,$bubbles_values[$ind]);
  }   }
       $result.='<td>'.$alphabet[$ind].': '.$ans.'</td>';
     }      }
     $result.='</tr></table>';      $result.='</tr></table>';
  } elsif ($target eq 'tex') {   } elsif ($target eq 'tex') {
Line 260  sub end_numericalresponse { Line 270  sub end_numericalresponse {
  }   }
  $result.='}\hline';   $result.='}\hline';
  for ($ind=$cou;$ind<$cou+$table_range[$j];$ind++) {   for ($ind=$cou;$ind<$cou+$table_range[$j];$ind++) {
     if (undef @formats) {      my $ans;
  my $ans = sprintf('%.'.$formats[0],$bubbles_values[$ind]);      if ($formats[0] ne '') {
  $result.=' '.$alphabet[$ind].': & '.$ans.' ';   $ans = sprintf('%.'.$formats[0],$bubbles_values[$ind]);
     } else {      } else {
  my $ans = sprintf('%.'.'d',$bubbles_values[$ind]);   my $badans = $bubbles_values[$ind];
  $result.=' '.$alphabet[$ind].': & '.$ans.' ';   my $format = ''; 
    #What is the number? (integer,decimal,floating point)
    if ($badans=~/^(\d*\.?\d*)(E|e)(\d*)$/) {
       $format = 'e'.$2;
    } elsif ($badans=~/^(\d*)\.(\d*)$/) {
       $format = '4f';
    } elsif ($badans=~/^(\d*)$/) {
       $format = 'd';
    }
    $ans = sprintf('%.'.$format,$bubbles_values[$ind]);
     }      }
       $result.=' '.$alphabet[$ind].': & '.$ans.' ';
     if ($ind != $cou+$table_range[$j]-1) {$result.=' & ';}      if ($ind != $cou+$table_range[$j]-1) {$result.=' & ';}
  }   }
  $j++;  
  $cou += $table_range[$j];   $cou += $table_range[$j];
    $j++;
  $result.='\\\\\hline\end{tabular}\vskip 0 mm ';   $result.='\\\\\hline\end{tabular}\vskip 0 mm ';
     }          }    
  }   }

Removed from v.1.60  
changed lines
  Added in v.1.63


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>