温柔网

 找回密码
 注册

查看: 643|回复: 0

一个计算器的程序

[复制链接]
发表于 2003-11-6 23:15:24 | 显示全部楼层 |阅读模式
<html>
<title>
计算器
</title>
<body>
<form action=calculator.asp method=post>
操作数1: <input type=text name=num1><br>
操作数2: <input type=text name=num2><br>
<p>
选择你要进行的操作<br>
<input type=radio name=operation value="加" checked>加<br>
<input type=radio name=operation value="减">减<br>
<input type=radio name=operation value="乘">乘<br>
<input type=radio name=operation value="除">除<br>
<input type=submit><input type=reset>
</form>
<hr>
<%
dim n1,n2,op
if request.form.count=0 then
        response.end
end if
n1=request.form("num1")
n2=request.form("num2")
op=request.form("operation")
if op="加" then
    response.write n1
    response.write "+"
    response.write n2
    response.write "="
    response.write clng(n1)+clng(n2)
elseif op="减" then
    response.write n1
    response.write "-"
    response.write n2
    response.write "="
    response.write clng(n1)-clng(n2)
elseif op="乘" then
    response.write n1
    response.write "*"
    response.write n2
    response.write "="
    response.write clng(n1)*clng(n2)
elseif op="除" then
    response.write n1
    response.write "/"
    response.write n2
    response.write "="
    response.write clng(n1)/clng(n2)
end if
%>
</body>
</html>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|温柔网 ( 浙ICP备13033583号-8 )

GMT+8, 2024-11-21 19:45 , Processed in 0.034273 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表