#!/usr/bin/env ruby
# coding: utf-8

require 'cgi'

c = CGI.new(:accept_charset => "UTF-8")
print "Content-type: text/html; charset=UTF-8\n\n"

# 各クイズの回答を取得
answers = []
(1..5).each do |i|
  answers << c["q#{i}"].to_i
end

# 正解数を計算
correct_count = answers.sum

# 結果を表示
print <<~EOF


<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title>結果と答え</title>
  <link rel="stylesheet" type="text/css" href="Phlox.css">
</head>

<body>
<p>#{correct_count}問正解です！</p>
</body>
</html>
EOF
