/[suikacvs]/perl/kanzan/kanzan.cgi
Suika

Diff of /perl/kanzan/kanzan.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wakaba, Sat Feb 23 11:49:52 2002 UTC revision 1.4 by wakaba, Wed Sep 4 09:02:38 2002 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  require Suika::CGI;  require Suika::CGI;
5    
6  my %ex_point1 = (  my %ex_point1 = ();
7    (
8    kokugo        => 54,    kokugo        => 54,
9    suugaku       => 55,    suugaku       => 55,
10    eigo  => 57,    eigo  => 57,
# Line 16  my %ex_point1 = ( Line 17  my %ex_point1 = (
17    _OBJECT       => 57,    _OBJECT       => 57,
18  );  );
19    
20  my %ex_point2 = (  my %ex_point2 = ();
21    (
22    kokugo        => 53,    kokugo        => 53,
23    suugaku       => 55,    suugaku       => 55,
24    eigo  => 55,    eigo  => 55,
# Line 29  my %ex_point2 = ( Line 31  my %ex_point2 = (
31    _OBJECT       => 58,    _OBJECT       => 58,
32  );  );
33    
34  my %ex_haiten1 = (  my %ex_haiten1 = ();
35    (
36    kokugo        => 80,    kokugo        => 80,
37    suugaku       => 80,    suugaku       => 80,
38    eigo  => 80,    eigo  => 80,
# Line 41  my %ex_haiten1 = ( Line 44  my %ex_haiten1 = (
44    seibutsu      => 0,    seibutsu      => 0,
45  );  );
46    
47  my %ex_haiten2 = (  my %ex_haiten2 = ();
48    (
49    kokugo        => 0,    kokugo        => 0,
50    suugaku       => 300,    suugaku       => 300,
51    eigo  => 150,    eigo  => 150,
# Line 64  sub kanzan (%%%%) { Line 68  sub kanzan (%%%%) {
68      $kanzaned1{_ALL} += $kanzaned1{$subject};      $kanzaned1{_ALL} += $kanzaned1{$subject};
69      $$full1{_ALL} += $$full1{$subject};      $$full1{_ALL} += $$full1{$subject};
70    }    }
71    $kanzaned1{_PERCENT} = 100*$kanzaned1{_ALL}/$$full1{_ALL};    $kanzaned1{_PERCENT} = $$full1{_ALL}==0?0:100*$kanzaned1{_ALL}/$$full1{_ALL};
72    $$full2{_ALL} = 0;    $$full2{_ALL} = 0;
73    for my $subject (keys %$full2) {    for my $subject (keys %$full2) {
74      next if $subject =~ /^_/;      next if $subject =~ /^_/;
# Line 72  sub kanzan (%%%%) { Line 76  sub kanzan (%%%%) {
76      $kanzaned2{_ALL} += $kanzaned2{$subject};      $kanzaned2{_ALL} += $kanzaned2{$subject};
77      $$full2{_ALL} += $$full2{$subject};      $$full2{_ALL} += $$full2{$subject};
78    }    }
79    $kanzaned2{_PERCENT} = 100*$kanzaned2{_ALL}/$$full2{_ALL};    $kanzaned2{_PERCENT} = $$full2{_ALL}==0?0:100*$kanzaned2{_ALL}/$$full2{_ALL};
80        
81    my ($percent, $object_percent);    my ($percent, $object_percent);
82    $percent = 100*($kanzaned1{_ALL}+$kanzaned2{_ALL})    $percent = ($$full1{_ALL}+$$full2{_ALL})==0?0:
83                 100*($kanzaned1{_ALL}+$kanzaned2{_ALL})
84                  /($$full1{_ALL}+$$full2{_ALL});                  /($$full1{_ALL}+$$full2{_ALL});
85    $object_percent = ($$point1{_OBJECT}*$$full1{_ALL}    $object_percent = ($$full1{_ALL}+$$full2{_ALL})==0?0:
86                        ($$point1{_OBJECT}*$$full1{_ALL}
87                      +$$point2{_OBJECT}*$$full2{_ALL})                      +$$point2{_OBJECT}*$$full2{_ALL})
88                  /($$full1{_ALL}+$$full2{_ALL});                  /($$full1{_ALL}+$$full2{_ALL});
89    ($percent, $object_percent, \%kanzaned1, \%kanzaned2);    ($percent, $object_percent, \%kanzaned1, \%kanzaned2);
# Line 102  if ($Suika::CGI::param{newform} ne 'no') Line 108  if ($Suika::CGI::param{newform} ne 'no')
108  my ($percent, $object, $kanzan1, $kanzan2)  my ($percent, $object, $kanzan1, $kanzan2)
109   = kanzan ({%mypoint1} => {%haiten1}, {%mypoint2} => {%haiten2});   = kanzan ({%mypoint1} => {%haiten1}, {%mypoint2} => {%haiten2});
110    
111  print STDOUT "Content-Type: text/html; charset=euc-jisx0213  print STDOUT "Content-Type: text/html; charset=euc-jp
112    Content-Style-Type: text/css
113    Content-Language: ja
114    
115  ";  ";
116  output_html (\%mypoint1 => \%haiten1 => $kanzan1,  output_html (\%mypoint1 => \%haiten1 => $kanzan1,
# Line 133  sub output_html (%%%%%) { Line 141  sub output_html (%%%%%) {
141  <html lang="ja">  <html lang="ja">
142  <head>  <head>
143  <title>配点換算</title>  <title>配点換算</title>
144    <link rev="made" href="mailto:w\@suika.fam.cx">
145    <link rel="contents" href="http://tomikou.net/">
146    <link rel="contents" href="/chuubu/">
147  <style type="text/css">  <style type="text/css">
148  input   {width: 3em}  input   {width: 3em}
149  </style>  </style>
# Line 250  input  {width: 3em} Line 261  input  {width: 3em}
261  <input type="submit" value="OK">  <input type="submit" value="OK">
262  </p>  </p>
263  </form>  </form>
264    
265    <div class="navigation">
266    [<a href="/gate/cvs/perl/kanzan/" xml:lang="en">source</a>]
267    </div>
268    </body>
269    </html>
270  EOH  EOH
271  }  }
272    
273  1;  =head1 LICENSE
274    
275    Copyright 2001-2002 wakaba E<lt>w@suika.fam.cxE<gt>.
276    
277    This program is free software; you can redistribute it and/or modify
278    it under the terms of the GNU General Public License as published by
279    the Free Software Foundation; either version 2 of the License, or
280    (at your option) any later version.
281    
282    This program is distributed in the hope that it will be useful,
283    but WITHOUT ANY WARRANTY; without even the implied warranty of
284    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
285    GNU General Public License for more details.
286    
287    You should have received a copy of the GNU General Public License
288    along with this program; see the file COPYING.  If not, write to
289    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
290    Boston, MA 02111-1307, USA.
291    
292    =cut
293    
294    1;      # $Date$
295    ### kanzan.cgi ends here

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24