博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
一个简单的java web 实现四则运算
阅读量:4311 次
发布时间:2019-06-06

本文共 3120 字,大约阅读时间需要 10 分钟。

<%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>
Insert title here

出题系统

1.真分数运算2.整数运算

出题形式:
出题数量:
<%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>
Insert title here<%JspWriter mout=pageContext.getOut();String mm= request.getParameter("num");String cho= request.getParameter("choose"); int choose=Integer.parseInt(cho); int m=Integer.parseInt(mm); int i=0; if(choose==2) { String pp[]=new String[m+1]; for(i=1;i<=m;i++) { int a=(int)(Math.random() * 100+1); int b=(int)(Math.random()*100+1); int c=(int)(Math.random()*4+1); String s=""; if(c==1) { s="+"; } if(c==2) { s="-"; } if(c==3) { s="*"; } if(c==4) { s="/"; } pp[i]=a+s+b; while(pp[i].equals(pp[i-1])) { a=(int)(Math.random() * 100+1); b=(int)(Math.random()*100+1); pp[i]=a+s+b; } mout.println(i+"、"+pp[i]+"=?"); mout.print("
"); } } else { String qq[]=new String[m+1]; for(i=1;i<=m;i++) { int e=(int)(Math.random()*100+1); int f=(int)(Math.random()*100+1); String ff=""; String gg=""; while(e==f) { e=(int)(Math.random()*100+1); f=(int)(Math.random()*100+1); } if(e>f) { ff=e+"/"+f; } if(f>e) { ff=f+"/"+e; } int p=(int)(Math.random()*100+1); int q=(int)(Math.random()*100+1); while(p==q) { p=(int)(Math.random()*100+1); q=(int)(Math.random()*100+1); } if(p>q) { gg=p+"/"+q; } if(q>p) { gg=q+"/"+p; } int x=(int)(Math.random()*4+1); String s=""; if(x==1) { s="+"; } if(x==2) { s="-"; } if(x==3) { s="*"; } if(x==4) { s="/"; } qq[i]=ff+s+gg; while(qq[i].equals(qq[i-1])) { e=(int)(Math.random()*100+1); f=(int)(Math.random()*100+1); while(e==f) { e=(int)(Math.random()*100+1); f=(int)(Math.random()*100+1); } if(e>f) {ff=e+"/"+f;} if(f>e) {ff=e+"/"+f;} p=(int)(Math.random()*100+1); q=(int)(Math.random()*100+1); while(q==p) { p=(int)(Math.random()*100+1); q=(int)(Math.random()*100+1); } if(p>q) { gg=p+"/"+q; } if(p
"); } } %>

主要思路是将之前简单的java编码转换成为web开发,在两个jsp文件中用

request.getParameter()方法来实现两个jsp文件中数据的获取这样就可以解决java转化成web中变量无法赋值的问题
 

转载于:https://www.cnblogs.com/yuezhihao/p/6490082.html

你可能感兴趣的文章
PHP课后小结 2017.12.22
查看>>
管理信息系统作业
查看>>
jQuery 菜单插件
查看>>
SQL函数汇总(MySQL教材)
查看>>
软件需求的薛定谔之猫
查看>>
字符串删除指定符号(不限位置)
查看>>
ArrayList、LinkedList、Vector的区别
查看>>
Hive常用函数 傻瓜学习笔记 附完整示例
查看>>
排列组合算法(基于c++实现)
查看>>
控制器跳转:tabbarcontroller怎么写代码切换视图?
查看>>
数组的常用排序
查看>>
异常(Exception)
查看>>
8款替代Dreamweaver的开源网页开发工具
查看>>
DRF之权限认证,过滤分页,异常处理
查看>>
IOC容器中Bean的生命周期方法
查看>>
网络基础 URL
查看>>
swoole安装和ssdb
查看>>
ACM学习之路————一个大整数与一个小整数不得不说得的秘密
查看>>
References & the Copy-Constructor
查看>>
local与protected的区别
查看>>