小米计算器亲戚称呼没有了?小米永恒模式是干嘛的

本文目录
- 小米计算器亲戚称呼没有了
- 小米永恒模式是干嘛的
- 网页版计算器
- 开发亲友计算器逻辑思考过程
- 华为辈分计算器在哪里
- 用JavaScript做个网页版的计算器
- 怎么在网页上制作一个简易计算器
- 我的爸爸的爷爷的爸爸的爸爸是我的什么
小米计算器亲戚称呼没有了
小米计算器亲戚称呼没有了
可以按这个方法设置。小米提供了设置的方法:进入设置——更多应用——已下载——找到计算器——点击卸载更新——返回桌面,打开应用商店——重新更新计算器,就可以了。
小米永恒模式是干嘛的
演示机型:小米11 系统版本:MIUI 11 小米永恒模式是开启超频模式。永恒模式是小米手机推出的一款新功能,永恒模式即开启超频模式,小爱同学会跟你一直讲话,讲话的内容不一,都是各种各样的内容,一直持续半个小时这个模式才会自动关闭。
小米手机小技巧:
1、远程协助:这个功能主要是方便家里的父母长辈,当他们不会操作的时候两台小米手机之间进行连接,连接成功后即可对父母的手机进行操作,还能听到另一边的声音,有了这个功能就可以手把手教父母操作手机了,实用有好用的好功能。
2、小米公交卡:这个功能使用的人非常广泛,当你早上急急忙忙出门忘带零钱和公交卡它能帮你刷,用户只需进入到小米钱包内,点击最上面中间位置的公交卡,选择地区等按照流程完成开卡,以后就可以愉快的使用小米手机刷公交了,从此以后告别实体公交卡。
3、亲戚计算器:这个功能非常的有趣并且挺使用,很多小伙伴春节去拜年往往因为亲戚众多而把称呼弄错,有了这个就可以解决喊错称呼的尴尬。
4。可视化通话菜单功能:语音服务电话接通后,直接在屏幕上弹出菜单,一键直达你需要的服务,不用因为没听清而去反复的挺套餐了,再也不用听完全部的语音提示后再去操作了。
网页版计算器
***隐藏网址***
***隐藏网址***
《head》
***隐藏网址***
《title》WEB计算器《/title》
《!---计算器功能模块--》
《script language="javascript" type="text/javascript" runat="server"》
var lingState="beStart"; //当前状态
var curOper="start"; //当前运算符
var num1=0; //初值
var num2=0; //初值
var subOper=false; // 是否刚刚单击过运算符
var upOper=false;//运算符的标签
var tnumber=false;//MR记住显示框的状态
var cM=false;//记住M启动
var xM=false;//记住按M+
var ms=false;//记住是否按MS
var sk=false;
var twonumber=false;
var ss;//保存MS要保存的值
var sb=0;
//数字键触发功能模块
function number(i)
{
if(subOper ) //表示在此之前刚刚单击过运算符或者刚刚单击过等号
{
form.ipt.value=i; //把输入的值赋给文本框显示
subOper=false;//输入数后,点击了符号
lingState="beInteger";
}
else
{ //表示正在进行或开始一个数字的输入
if(form.ipt.value=="0")//当文本显示框为0时,则把刚刚单击的数值赋给文本框
{
form.ipt.value=i;//当符合条件则把单击的数值(this.value)赋予给显示框1
lingState="beInteger";
}
else
form.ipt.value += i;//当文本显示框不为0,则数值累加显示文本框
}
if(curOper!="start")//判断是否单击过运算符
{
num2=form.ipt.value;
}
// alert("初值num1的值"+num1);
// alert("num2的值"+num2);
//lingState="beStart"; //清除当前状态
upOper=true;//记住输入数字 以便下面+号连+运算
tnumber=true;//记住有值
}
/* + - * / */
//结果运算模块
function sum()
{
if (curOper!="start")//判断是否单击按钮(符号为空
{
switch(curOper)
{
case "+": //判断符号为+时执行+运算
num1= parseFloat(num1)+parseFloat(num2); //把第一次输入的值和第二次的值进行运算
break;
case "-": //判断符号为-时执行+运算
num1= parseFloat(num1)-parseFloat(num2);
break;
case "*": //判断符号为*时执行+运算
num1= parseFloat(num1)*parseFloat(num2);
break;
case "/": //判断符号为/时执行+运算
if(num2=="0")
{
alert("除数不能为零");
}
else{
num1= parseFloat(num1)/parseFloat(num2);
}
break;
}
form.ipt.value=num1;//把运算结果赋给显示框
}
subOper=true;//输入数后,点击了符号
//curOper="start"; //清除当前符号状态
lingState="beStart";//清除当前状态
upOper=false;//=运算一次后记住 避免再按+号又进行运算 ( 清除当前符号状态
sk=true;
}
//常规符号运算功能模块
function allfhao(i)
{
subOper=true;//输入数后 输入符号 进行运算
if (curOper=="start")//实现连运算 原理:当运行当前运算符时实现连运算
{
num1=form.ipt.value; //把第一个数赋值给num1
curOper=i; //单击运算符用变量把运算符记住
tnumber=true;
}
else
{
if(upOper)//当upOper为真时则实现连运算
{
sum();//当符合条件时调用结果运算 实现连运算
}
curOper=i;//单击运算符用变量把运算符记住
}
upOper=false;//=运算一次后记住 避免再按+号又进行运算 ( 清除当前符号状态
lingState="beStart";//清除当前状态
// alert("符号num1的值"+num1);
// alert("num2的值"+num2);
}
//小数点功能模块
function point()
{
if(form.ipt.value.indexOf(".")==-1) //判断是否有小数点,如果有就不显示 如果没有那么进行下面的运算
{
if(lingState=="beStart")//如果进行了等号运算 但并没有小数点 但单击了小数点则显示0.几
{
form.ipt.value="0.";//当符合条件则显示框1 显示0.
subOper=false;//输入数后,点击了符号
lingState="beFloat"; //让一个变量记住以输入小数点
}
if(lingState=="beInteger" )//判断是否有数输入,如果有数数输入但不是接这等号运算则显示小数点
{
form.ipt.value+=".";//当符合条件则显示小数点
lingState="beFloat";//用一个变量记住已经输入一个小数点,当下次输入由于值的改变则不能输入,起到只能输入一个小数点的功能
}
}
}
//全部清除功能模块 C CE Backspace
function cleaktext(i)
{
switch(i)
{
case"C"://清除C
form.ipt.value="0"; //清除文本框内的内容
lingState="beStart"; //清除当前状态
curOper="start"; //清除当前符号状态
subOper=false; // 是否刚刚单击过运算符
upOper=false;//运算符的标签
num1=0;
num2=0;
break;
case"CE": //清除CE
form.ipt.value="0"; //清除文本框内的内容
break;
case"Backspace": //推格删除
if(cM=false)//如果启动MR那么不能实现推格功能
{
if(upOper)
{
if (form.ipt.value.length》1)
{
form.ipt.value=form.ipt.value.substring(0,form.ipt.value.length-1); //运用substring取字符串方法将返回一个包含从原始对象中获得的子字符串的 String 对象。 使用 start 和 end 两者的较小值作为子字符串的起始点。
}
else
{
form.ipt.value="0";//一个一个删除
}
}
break;
}
}
}
/* % 1/x sqrt +/- pi */
//全部的特殊符号运算模块
function alltx(i)
{
switch(i)
{
case "%"://%运算
form.ipt.value=form.ipt.value/100;
num2=form.ipt.value;
break;
case "1/x":
if(form.ipt.value=="0"){
form.ipt.value="除数不能为零。";
}
else {
form.ipt.value=1/form.ipt.value;
num2=form.ipt.value;
}
break;
case "sqrt"://开方
form.ipt.value=Math.sqrt(form.ipt.value); //math对象 开方运算
num2=form.ipt.value;
break;
case "+/-"://+/-运算符 负号运算
if(upOper)//当运行了符号则不能按负号
{
form.ipt.value=0-form.ipt.value;
num2=form.ipt.value;
}
else{
form.ipt.value="0";
}
break;
case "pi":
form.ipt.value="3.1415926";
num2=form.ipt.value;
break;
case "sin":
form.ipt.value=Math.sin(form.ipt.value);
num2=form.ipt.value;
break;
case "cos":
form.ipt.value=Math.sin(form.ipt.value);
num2=form.ipt.value;
break;
case "tan":
form.ipt.value=Math.sin(form.ipt.value);
num2=form.ipt.value;
break;
}
}
//全部M系列功能模块
function checkallM(i){
switch(i)
{
case"M+"://启动M系列功能模块
if(form.ipt.value!="0" && ms==false)
{
form.ipt1.value="M";//在显示框2显示M以告知用户以启动M系列功能
sm=form.ipt.value;
}
if(form.ipt1.value=="M" && ms!=false)
{
sm=eval(ss+’+’+form.ipt.value);//MR保存的值提取实现M+功能
}
xM=true; //记住单击过M+ 以便MR操作
break;
case "MS"://启用M系列功能 启动记忆功能(记忆上一次计算结果)
ss=form.ipt.value;// 把显示框结果给SS保存(予以MR提取
if(form.ipt.value=="0")//当显示框1显示结果为0时单击MS时也可以清除显示框2 M功能
{
form.ipt1.value="";//清除显示框2 M
}
if(form.ipt.value!="0")
{
form.ipt1.value="M";
}
ms=true; //记住单击过Ms 以便MR操作 (看是否赋+运算后的值 还是当前值
break;
case "MR"://提取MS保存数值功能
if(xM)//是否单击m+
{
if(form.ipt1.value=="M" )//当启动M功能时 MR才能起到保存提取的功能
{
form.ipt.value=sm;//当条件符合 则把MS保存的值 并实现M+功能
}
else if(subOper || tnumber){//没有启动M功能 则清除显示框
form.ipt.value="0";
}
}
// else{ form.ipt.value=ss;}
break;
case "MC": // 清除M显示框中M系列的功能
form.ipt1.value="";//清空显示框2的 M功能
xM=false;
ms=false;
break;
}
cM=true;
lingState="beStart";//清除当前状态
}
//onLoad="setStart()"
《/script》
《style type="text/css" 》
#c{
width:320px;
height:270px;
border:#666666 5px groove;
background-color:#ECE9D8
}
#ipts{ margin:5px 5px 3px 5px; text-align:right; width:270px}
#s{ margin:7px 5px 6px 5px; height:200px}
.bt{ width:30px; height:30px; background-color:#ECE9D8; border:solid 1px #C8C6B0}
.bt2{width:75px; height:30px; color:#F00; background-color:#ECE9D8; border:solid 1px #C8C6B0;}
.bt3{width:20px; height:20px; text-align:center;}
.wz{ font-size:12px}
《/style》
《/head》
《body 》
《!---隐藏层--》
《div id="s"》
《FORM METHOD=POST ACTION="" name="form"》
《div id="c"》
《table width="98%" height="268" border="0" align="center" cellpadding="0"》
《tr》
《td height="19" colspan="7"》
《table width="294" border="0" cellpadding="0" cellspacing="0" 》
《tr》
《td class="wz" width="12" height="19"》 《/td》
《td class="wz" width="47"》(E)《/td》
《td class="wz" width="49"》查看(V)《/td》
《td class="wz" width="186"》帮助(H)《/td》
《/tr》
《/table》《/td》《/tr》
《tr》
《td height="29" colspan="7"》
《div id="ipts"》
《input name="ipt" type="text" id="ipts" value="0" size="40" maxlength="20" readonly="readonly" /》
《/div》
《/td》《/tr》
《!-- ipt1 Backspace CE C --》
《tr》
《td height="38" colspan="7" align="center"》《table width="100%" border="0" cellspacing="0" cellpadding="0"》
《tr》
《td width="14%" align="center"》《input name="ipt1" type="text" disabled="disabled" class="bt3" size="1" maxlength="0" /》《/td》
《td width="86%" align="center"》《table width="97%" border="0" cellspacing="0" cellpadding="0"》
《tr》
《td align="center"》《input name="button23" type="button" class="bt2" id="button23" style="color:#00F" value="Backspace" onclick="cleaktext(this.value)"/》《/td》
《td align="center"》《input style="color:#00F" name="button21" type="button" class="bt2" id="button20" value="CE" onclick="cleaktext(this.value)"/》《/td》
《td align="center"》《input style="color:#00F" name="button20" type="button" class="bt2" id="button21" value="C" onclick="cleaktext(this.value)"/》《/td》
《/tr》
《/table》《/td》
《/tr》
《/table》《/td》
《/tr》
《!-- MC 7 8 9 / sqrt --》
《tr》
《td width="16%" align="center"》《table width="99%" height="162" border="0"》
《tr》
《td height="35" align="center"》《input style="color:#F00" type="button" value="MC" class="bt" onclick="checkallM(this.value)"/》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button1" type="button" class="bt" id="button1" value="7" onclick="number(this.value)" /》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button2" type="button" class="bt" id="button2" value="8" onclick="number(this.value)" /》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button3" type="button" class="bt" id="button3" value="9" onclick="number(this.value)"/》《/td》
《td width="13%" align="center"》《input style="color:#F00" name="button4" type="button" class="bt" id="button4" value="/" onclick="allfhao(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button5" type="button" class="bt" id="button5" value="sqrt" onclick="alltx(this.value)"/》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button24" type="button" class="bt" id="button24" value="sin" onclick="alltx(this.value)"/》《/td》
《/tr》
《!-- MR 4 5 6 * % --》
《tr》
《td width="13%" height="39" align="center"》《input style="color:#F00" type="button" value="MR" class="bt" onclick="checkallM(this.value)"/》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button6" type="button" class="bt" id="button6" value="4" onclick="number(this.value)" /》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button7" type="button" class="bt" id="button7" value="5" onclick="number(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button8" type="button" class="bt" id="button8" value="6" onclick="number(this.value)"/》《/td》
《td width="13%" align="center"》《input style="color:#F00" name="button9" type="button" class="bt" id="button9" value="*" onclick="allfhao(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button10" type="button" class="bt" id="button10" value="%" onclick="alltx(this.value)"/》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button25" type="button" class="bt" id="button25" value="cos" onclick="alltx(this.value)"/》《/td》
《/tr》
《!-- MS 1 2 3 - 1/x --》
《tr》
《td width="13%" height="38" align="center"》《input style="color:#F00" type="button" value="MS" class="bt" onclick="checkallM(this.value)" /》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button11" type="button" class="bt" id="button11" value="1" onclick="number(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button12" type="button" class="bt" id="button12" value="2" onclick="number(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button13" type="button" class="bt" id="button13" value="3" onclick="number(this.value)"/》《/td》
《td width="13%" align="center"》《input style="color:#F00" name="button14" type="button" class="bt" id="button14" value="-" onclick="allfhao(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button15" type="button" class="bt" id="button15" value="1/x" onclick="alltx(this.value)"/》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button26" type="button" class="bt" id="button26" value="tan" onclick="alltx(this.value)"/》《/td》
《/tr》
《!-- M+ 0 +/- . + = --》
《tr》
《td width="13%" height="38" align="center"》《input style="color:#F00" type="button" value="M+" class="bt" onclick="checkallM(this.value)"/》《/td》
《td width="16%" height="38" align="center"》《input style="color:#00F" name="button16" type="button" class="bt" id="button16" value="0" onclick="number(this.value)"/》《/td》
《td width="14%" height="38" align="center"》《input style="color:#00F" name="button17" type="button" class="bt" id="button17" value="+/-" onclick="alltx(this.value)"/》《/td》
《td width="14%" align="center"》《input style="color:#00F" name="button18" type="button" class="bt" id="button18" value="." onclick="point()"/》《/td》
《td width="13%" align="center"》《input style="color:#F00" name="button19" type="button" class="bt" id="button19" value="+" onclick="allfhao(this.value)" /》《/td》
《td width="14%" align="center"》《input style="color:#F00" name="button22" type="button" class="bt" id="button22" value="=" onclick="sum()"/》《/td》
《td width="16%" align="center"》《input style="color:#00F" name="button27" type="button" class="bt" id="button27" value="pi" onclick="alltx(this.value)"/》《/td》
《/tr》
《/table》
《/td》《/tr》《/table》
《/div》
《/FORM》
《/div》
《/body》
《/html》
开发亲友计算器逻辑思考过程
由于业务需求,需要实现亲友计算的功能.
1 . 直接采用匹配的方式.
看到需求时,首先想到去网上查找了下,有没有类似的demo.由于我是Android开发,没有找到相对应源码,然后就考虑自己动手写.我在Github上找到了使用js实现的demo,简单的了解了下实现原理:拿到需要计算的数值,做出相对应的组合,例如:哥哥的哥哥,直接变成哥哥.然后把组合的结果,直接去匹配自己写的表达式, 例如:爸爸的儿子的爸爸的爸爸 会直接组合成 爸爸的爸爸 然后去匹配 爸爸的爸爸是爷爷 这样的方式.然后得出结果.但是这种组合方式至少有几千种,而且性能很差.我要自己动手写,显然很啰嗦,麻烦.
2 . �分布计算
对于这种关系处理首先我想到的是采用两种组合计算的方式,就是一步一步计算过去. 例如 爸爸的哥哥的儿子的妻子 我先计算爸爸的哥哥得出大伯,大伯的儿子得出堂哥或者堂弟然后妻子为堂嫂,堂弟媳.但是不能使用文字来匹配,不然太庞大了,想着对于每一个人都要一个数字来对应,就是我代表0,爸爸代表1,妈妈代表2... 把所有的�亲戚关系都以一个数字来代替,我还很聪明的把男的用作单数,他的妻子用着双数,这样对于一个人的妻子或者丈夫就直接可以使用+1,-1来计算了.当然这些只是思路,按照这个逻辑关系继续思考的话,会发现并不比第一种方式容易.因为每一个关系都有几种计算方式,对于每个代表的数值都需要进行几种计算,就是对于1(爸爸),我需要算出他的兄弟姐妹,父母,子女和自己的关系,2(妈妈)一样还是要把所有的情况列举出来.繁琐程度不亚于第一种情况,而且还会有很多不健全的地方,例如 爸爸的儿子的妻子 答案有三个 嫂子,弟媳,老婆. 如果在远一点 爸爸的爸爸的儿子的儿子的老婆 则有 嫂子,弟媳,老婆,堂嫂,堂弟媳.这种方式完全不能实现.
3.直接计算.
爷爷的孙媳妇有嫂子,弟媳,老婆,堂嫂,堂弟媳 ,爸爸的儿媳有嫂子,弟媳,老婆 ,看到这里时,突然一个新的思路出现了,对于一个人或者说一个身份来说,他的后代的叫法都是一致的,我哥哥的下一代一定是我的侄辈,男的是侄子,女的是侄女.我姐姐的是儿子是外甥,女儿是外甥女.我大伯的儿子一定是我的堂哥或者堂弟,你要计算某个人和你的关系,你就必须要和他有关系,和你有关系的只有父母,�子女,丈夫,妻子.而你的爷爷,或者大伯,舅舅是因为和你的父辈有关系才和你连接上的.所以你们一定有一条线连接起来,这样我只要知道,这条线的最高点,需要计算的这个人和我两直接的差距就可以了.线的最高点是什么意思了,举个例子: 爸爸的哥哥的儿子 最高点就是爸爸的哥哥也就是大伯, 爸爸的爸爸的儿子 最高点就是爸爸的爸爸也就是爷爷 也就是需要计算的那个辈分最高的人,而我们的差距就是你�是什么辈分 ,我把自己一辈定义为0代, 爸爸 , 妈妈,大伯,舅舅...定义为1代,爷爷2代,儿子,侄子,堂侄-1代... 爸爸的兄弟的儿子 最高点爸爸的哥哥就是大伯 ,他的儿子0代,和我同代,那肯定就是堂哥,堂弟了 爸爸的爸爸的儿子 最高点是爷爷 他的儿子辈分是1辈 就是你父辈,那就只要爸爸,叔叔,大伯. 只要定义两个变量,一个来记录当前人的辈分,出现父母就+1,儿女就-1,另外一个变量来记录最高点,结果就是根据最高点然后计算他的后辈就行了.需要注意的是,在计算前,需要对值先进行整合, 就是哥哥的哥哥 直接整合成哥哥 xxx的儿子的爸爸一定是xxx(xxx是男性)或者xxx的老公(xxx是女性)....,需要把所有的诱惑,或者这种不必要的给整合起来. 计算时,要注意除了你的配偶或者你的�直系亲属的兄弟姐妹和你有关系,其他人的配偶的兄弟姐妹和你都没关系 ,就像你大嫂的兄弟姐妹和你没有关系,需要做好这方面的判断. 还有爷爷的孙辈一定是你父亲的子辈和�父亲兄弟的子辈. 还需要注意出现最高点是爷爷,这个人和你同辈,但是可能是你爷爷的儿子后辈,也可能是你爷爷女儿的后辈.把这些处理好了,也就差不多了,
写的有点简单,只是个逻辑思考过程.就是一个思路而已.
华为辈分计算器在哪里
计算器的实用工具。
1、首先打开华为手机主页面。
2、其次在打开的界面找到搜索框,在里面输入计算器。
3、最后在计算器里点击实用工具即可找到辈分计算器。
用JavaScript做个网页版的计算器
哎呀!这个简单!!我给你啦!!!下面就是用Jscript写的计算器了复制后保存一切就OK的啦!!!!!!!!!
《html》
《head》
***隐藏网址***
《!--written by GoldHuman li hai--》
《!--2000.8--》
《title》科学计算器《/title》
《style》
《!--
BODY {
font-family: "宋体", "Arial", "Times New Roman";
font-size: 9pt;
background-color: #edf0e1;
color: #0001fC;
background-attachment: fixed;
}
td{font-family: "宋体", "Arial Narrow", "Times New Roman"; font-size:9pt; font-color:#000000}
//--》
《/style》
《script language="javascript"》
《!--
var endNumber=true
var mem=0
var carry=10
var hexnum="0123456789abcdef"
var angle="d"
var stack=""
var level="0"
var layer=0
//数字键
function inputkey(key)
{
var index=key.charCodeAt(0);
if ((carry==2 && (index==48 || index==49))
|| (carry==8 && index》=48 && index《=55)
|| (carry==10 && (index》=48 && index《=57 || index==46))
|| (carry==16 && ((index》=48 && index《=57) || (index》=97 && index《=102))))
if(endNumber)
{
endNumber=false
document.calc.display.value = key
}
else if(document.calc.display.value == null || document.calc.display.value == "0")
document.calc.display.value = key
else
document.calc.display.value += key
}
function changeSign()
{
if (document.calc.display.value!="0")
if(document.calc.display.value.substr(0,1) == "-")
document.calc.display.value = document.calc.display.value.substr(1)
else
document.calc.display.value = "-" + document.calc.display.value
}
//函数键
function inputfunction(fun,shiftfun)
{
endNumber=true
if (document.calc.shiftf.checked)
document.calc.display.value=decto(funcalc(shiftfun,(todec(document.calc.display.value,carry))),carry)
else
document.calc.display.value=decto(funcalc(fun,(todec(document.calc.display.value,carry))),carry)
document.calc.shiftf.checked=false
document.calc.hypf.checked=false
inputshift()
}
function inputtrig(trig,arctrig,hyp,archyp)
{
if (document.calc.hypf.checked)
inputfunction(hyp,archyp)
else
inputfunction(trig,arctrig)
}
//运算符
function operation(join,newlevel)
{
endNumber=true
var temp=stack.substr(stack.lastIndexOf("(")+1)+document.calc.display.value
while (newlevel!=0 && (newlevel《=(level.charAt(level.length-1))))
{
temp=parse(temp)
level=level.slice(0,-1)
}
if (temp.match(/^(.*\d+)$/))
document.calc.display.value=RegExp.$2
stack=stack.substr(0,stack.lastIndexOf("(")+1)+temp+join
document.calc.operator.value=" "+join+" "
level=level+newlevel
}
//括号
function addbracket()
{
endNumber=true
document.calc.display.value=0
stack=stack+"("
document.calc.operator.value=" "
level=level+0
layer+=1
document.calc.bracket.value="(="+layer
}
function disbracket()
{
endNumber=true
var temp=stack.substr(stack.lastIndexOf("(")+1)+document.calc.display.value
while ((level.charAt(level.length-1))》0)
{
temp=parse(temp)
level=level.slice(0,-1)
}
document.calc.display.value=temp
stack=stack.substr(0,stack.lastIndexOf("("))
document.calc.operator.value=" "
level=level.slice(0,-1)
layer-=1
if (layer》0)
document.calc.bracket.value="(="+layer
else
document.calc.bracket.value=""
}
//等号
function result()
{
endNumber=true
while (layer》0)
disbracket()
var temp=stack+document.calc.display.value
while ((level.charAt(level.length-1))》0)
{
temp=parse(temp)
level=level.slice(0,-1)
}
document.calc.display.value=temp
document.calc.bracket.value=""
document.calc.operator.value=""
stack=""
level="0"
}
//修改键
function backspace()
{
if (!endNumber)
{
if(document.calc.display.value.length》1)
document.calc.display.value=document.calc.display.value.substring(0,document.calc.display.value.length - 1)
else
document.calc.display.value=0
}
}
function clearall()
{
document.calc.display.value=0
endNumber=true
stack=""
level="0"
layer=""
document.calc.operator.value=""
document.calc.bracket.value=""
}
//转换键
function inputChangCarry(newcarry)
{
endNumber=true
document.calc.display.value=(decto(todec(document.calc.display.value,carry),newcarry))
carry=newcarry
document.calc.sin.disabled=(carry!=10)
document.calc.cos.disabled=(carry!=10)
document.calc.tan.disabled=(carry!=10)
document.calc.bt.disabled=(carry!=10)
document.calc.pi.disabled=(carry!=10)
document.calc.e.disabled=(carry!=10)
document.calc.kp.disabled=(carry!=10)
document.calc.k2.disabled=(carry《=2)
document.calc.k3.disabled=(carry《=2)
document.calc.k4.disabled=(carry《=2)
document.calc.k5.disabled=(carry《=2)
document.calc.k6.disabled=(carry《=2)
document.calc.k7.disabled=(carry《=2)
document.calc.k8.disabled=(carry《=8)
document.calc.k9.disabled=(carry《=8)
document.calc.ka.disabled=(carry《=10)
document.calc.kb.disabled=(carry《=10)
document.calc.kc.disabled=(carry《=10)
document.calc.kd.disabled=(carry《=10)
document.calc.ke.disabled=(carry《=10)
document.calc.kf.disabled=(carry《=10)
}
function inputChangAngle(angletype)
{
endNumber=true
angle=angletype
if (angle=="d")
document.calc.display.value=radiansToDegress(document.calc.display.value)
else
document.calc.display.value=degressToRadians(document.calc.display.value)
endNumber=true
}
function inputshift()
{
if (document.calc.shiftf.checked)
{
document.calc.bt.value="deg "
document.calc.ln.value="exp "
document.calc.log.value="expd"
if (document.calc.hypf.checked)
{
document.calc.sin.value="ahs "
document.calc.cos.value="ahc "
document.calc.tan.value="aht "
}
else
{
document.calc.sin.value="asin"
document.calc.cos.value="acos"
document.calc.tan.value="atan"
}
document.calc.sqr.value="x^.5"
document.calc.cube.value="x^.3"
document.calc.floor.value="小数"
}
else
{
document.calc.bt.value="d.ms"
document.calc.ln.value=" ln "
document.calc.log.value="log "
if (document.calc.hypf.checked)
{
document.calc.sin.value="hsin"
document.calc.cos.value="hcos"
document.calc.tan.value="htan"
}
else
{
document.calc.sin.value="sin "
document.calc.cos.value="cos "
document.calc.tan.value="tan "
}
document.calc.sqr.value="x^2 "
document.calc.cube.value="x^3 "
document.calc.floor.value="取整"
}
}
//存储器部分
function clearmemory()
{
mem=0
document.calc.memory.value=" "
}
function getmemory()
{
endNumber=true
document.calc.display.value=decto(mem,carry)
}
function putmemory()
{
endNumber=true
if (document.calc.display.value!=0)
{
mem=todec(document.calc.display.value,carry)
document.calc.memory.value=" M "
}
else
document.calc.memory.value=" "
}
function addmemory()
{
endNumber=true
mem=parseFloat(mem)+parseFloat(todec(document.calc.display.value,carry))
if (mem==0)
document.calc.memory.value=" "
else
document.calc.memory.value=" M "
}
function multimemory()
{
endNumber=true
mem=parseFloat(mem)*parseFloat(todec(document.calc.display.value,carry))
if (mem==0)
document.calc.memory.value=" "
else
document.calc.memory.value=" M "
}
//十进制转换
function todec(num,oldcarry)
{
if (oldcarry==10 || num==0) return(num)
var neg=(num.charAt(0)=="-")
if (neg) num=num.substr(1)
var newnum=0
for (var index=1;index《=num.length;index++)
newnum=newnum*oldcarry+hexnum.indexOf(num.charAt(index-1))
if (neg)
newnum=-newnum
return(newnum)
}
function decto(num,newcarry)
{
var neg=(num《0)
if (newcarry==10 || num==0) return(num)
num=""+Math.abs(num)
var newnum=""
while (num!=0)
{
newnum=hexnum.charAt(num%newcarry)+newnum
num=Math.floor(num/newcarry)
}
if (neg)
newnum="-"+newnum
return(newnum)
}
//表达式解析
function parse(string)
{
if (string.match(/^(.*\d+)$/))
return(RegExp.$1+cypher(RegExp.$2,RegExp.$3,RegExp.$4))
else
return(string)
}
//数学运算和位运算
function cypher(left,join,right)
{
left=todec(left,carry)
right=todec(right,carry)
if (join=="+")
return(decto(parseFloat(left)+parseFloat(right),carry))
if (join=="-")
return(decto(left-right,carry))
if (join=="*")
return(decto(left*right,carry))
if (join=="/" && right!=0)
return(decto(left/right,carry))
if (join=="%")
return(decto(left%right,carry))
if (join=="&")
return(decto(left&right,carry))
if (join=="|")
return(decto(left|right,carry))
if (join=="^")
return(decto(Math.pow(left,right),carry))
if (join=="x")
return(decto(left^right,carry))
if (join=="《")
return(decto(left《《right,carry))
alert("除数不能为零")
return(left)
}
//函数计算
function funcalc(fun,num)
{
with(Math)
{
if (fun=="pi")
return(PI)
if (fun=="e")
return(E)
if (fun=="abs")
return(abs(num))
if (fun=="ceil")
return(ceil(num))
if (fun=="round")
return(round(num))
if (fun=="floor")
return(floor(num))
if (fun=="deci")
return(num-floor(num))
if (fun=="ln" && num》0)
return(log(num))
if (fun=="exp")
return(exp(num))
if (fun=="log" && num》0)
return(log(num)*LOG10E)
if (fun=="expdec")
return(pow(10,num))
if (fun=="cube")
return(num*num*num)
if (fun=="cubt")
return(pow(num,1/3))
if (fun=="sqr")
return(num*num)
if (fun=="sqrt" && num》=0)
return(sqrt(num))
if (fun=="!")
return(factorial(num))
if (fun=="recip" && num!=0)
return(1/num)
if (fun=="dms")
return(dms(num))
if (fun=="deg")
return(deg(num))
if (fun=="~")
return(~num)
if (angle=="d")
{
if (fun=="sin")
return(sin(degressToRadians(num)))
if (fun=="cos")
return(cos(degressToRadians(num)))
if (fun=="tan")
return(tan(degressToRadians(num)))
if (fun=="arcsin" && abs(num)《=1)
return(radiansToDegress(asin(num)))
if (fun=="arccos" && abs(num)《=1)
return(radiansToDegress(acos(num)))
if (fun=="arctan")
return(radiansToDegress(atan(num)))
}
else
{
if (fun=="sin")
return(sin(num))
if (fun=="cos")
return(cos(num))
if (fun=="tan")
return(tan(num))
if (fun=="arcsin" && abs(num)《=1)
return(asin(num))
if (fun=="arccos" && abs(num)《=1)
return(acos(num))
if (fun=="arctan")
return(atan(num))
}
if (fun=="hypsin")
return((exp(num)-exp(0-num))*0.5)
if (fun=="hypcos")
return((exp(num)+exp(-num))*0.5)
if (fun=="hyptan")
return((exp(num)-exp(-num))/(exp(num)+exp(-num)))
if (fun=="ahypsin" | fun=="hypcos" | fun=="hyptan")
{
alert("对不起,公式还没有查到!")
return(num)
}
alert("超出函数定义范围")
return(num)
}
}
function factorial(n)
{
n=Math.abs(parseInt(n))
var fac=1
for (;n》0;n-=1)
fac*=n
return(fac)
}
function dms(n)
{
var neg=(n《0)
with(Math)
{
n=abs(n)
var d=floor(n)
var m=floor(60*(n-d))
var s=(n-d)*60-m
}
var dms=d+m/100+s*0.006
if (neg)
dms=-dms
return(dms)
}
function deg(n)
{
var neg=(n《0)
with(Math)
{
n=abs(n)
var d=floor(n)
var m=floor((n-d)*100)
var s=(n-d)*100-m
}
var deg=d+m/60+s/36
if (neg)
deg=-deg
return(deg)
}
function degressToRadians(degress)
{
return(degress*Math.PI/180)
}
function radiansToDegress(radians)
{
return(radians*180/Math.PI)
}
//界面
//--》
《/script》
《/head》
《!--written by GoldHuman li hai--》
《!--2000.8--》
《body》
《div align="center"》
《form name=calc》
《table border="1" width="500" height="250"》
《tr》
《td height=50》
《table width=500》
《td》
《img src="../img/cp_logo.gif"》
《/td》
《td》
《div align=center》
《input type=text name="display" value="0" readonly size="40"》
《/div》
《/td》
《/table》
《/td》
《/tr》
《tr》
《td》
《table width=500》
《tr》
《td width=290》
《input type=radio name="carry" onClick="inputChangCarry(16)"》
十六进制
《input type=radio name="carry" checked onClick="inputChangCarry(10)"》
十进制
《input type=radio name="carry" onClick="inputChangCarry(8)"》
八进制
《input type=radio name="carry" onClick="inputChangCarry(2)"》
二进制
《/td》
《td》
《/td》
《td width=135》
《input type=radio name="angle" value="d" onClick="inputChangAngle(’d’)" checked》
角度制
《input type=radio name="angle" value="r" onClick="inputChangAngle(’r’)"》
弧度制
《/td》
《/tr》
《/table》
《table width=500》
《tr》
《td width=170》
《input name="shiftf" type="checkbox" onclick="inputshift()"》上档功能
《input name="hypf" type="checkbox" onclick="inputshift()"》双曲函数
《/td》
《td》
《input name="bracket" value="" type=text size=3 readonly style="background-color=lightgrey"》
《input name="memory" value="" type=text size=3 readonly style="background-color=lightgrey"》
《input name="operator" value="" type=text size=3 readonly style="background-color=lightgrey"》
《/td》
《td width=183》
《input type="button" value=" 退格 "
onclick="backspace()" style="color=red"》
《input type="button" value=" 清屏 "
onClick="document.calc.display.value = 0 " style="color=red"》
《input type="button" value=" 全清"
onClick="clearall()" style="color=red"》
《/td》
《/tr》
《/table》
《table width=500》
《tr》
《td》
《table》
《tr align=center》
《td》
《input name=pi type="button" value=" PI "
onClick="inputfunction(’pi’,’pi’)" style="color=blue"》
《/td》
《td》
《input name=e type="button" value=" E "
onClick="inputfunction(’e’,’e’)" style="color=blue"》
《/td》
《td》
《input name=bt type="button" value="d.ms"
onClick="inputfunction(’dms’,’deg’)" style="color=#ff00ff"》
《/td》
《/tr》
《tr align=center》
《td》
《input type="button" value=" ( "
onClick="addbracket()" style="color=#ff00ff"》
《/td》
《td》
《input type="button" value=" ) "
onClick="disbracket()" style="color=#ff00ff"》
《/td》
《td》
《input name=ln type="button" value=" ln "
onClick="inputfunction(’ln’,’exp’)" style="color=#ff00ff"》
《/td》
《/tr》
《tr align=center》
《td》
《input name=sin type="button" value="sin "
onClick="inputtrig(’sin’,’arcsin’,’hypsin’,’ahypsin’)" style="color=#ff00ff"》
《/td》
《td》
《input type="button" value="x^y "
onClick="operation(’^’,7)" style="color=#ff00ff"》
《/td》
《td》
《input name=log type="button" value="log "
onClick="inputfunction(’log’,’expdec’)" style="color=#ff00ff"》
《/td》
《/tr》
《tr align=center》
《td》
《input name=cos type="button" value="cos "
onClick="inputtrig(’cos’,’arccos’,’hypcos’,’ahypcos’)" style="color=#ff00ff"》
《/td》
《td》
《input name=cube type="button" value="x^3 "
onClick="inputfunction(’cube’,’cubt’)" style="color=#ff00ff"》
《/td》
《td》
《input type="button" value=" n! "
onClick="inputfunction(’!’,’!’)" style="color=#ff00ff"》
《/td》
《/tr》
《tr align=center》
《td》
《input name=tan type="button" value="tan "
onClick="inputtrig(’tan’,’arctan’,’hyptan’,’ahyptan’)" style="color=#ff00ff"》
《/td》
《td》
《input name=sqr type="button" value="x^2 "
onClick="inputfunction(’sqr’,’sqrt’)" style="color=#ff00ff"》
《/td》
《td》
《input type="button" value="1/x "
onClick="inputfunction(’recip’,’recip’)" style="color=#ff00ff"》
《/td》
《/tr》
《/table》
《/td》
《td width=30》
《/td》
《td》
《table》
《tr》
《td》
《input type="button" value=" 储存 "
onClick="putmemory()" style="color=red"》
《/td》
《/tr》
《td》
《input type="button" value=" 取存 "
onClick="getmemory()" style="color=red"》
《/td》
《/tr》
《tr》
《td》
《input type="button" value=" 累存 "
onClick="addmemory()" style="color=red"》
《/td》
《/tr》
《tr》
《td》
《input type="button" value=" 积存 "
onClick="multimemory()" style="color=red"》
《/td》
《/tr》
《tr》
《td height="33"》
《input type="button" value=" 清存 "
onClick="clearmemory()" style="color=red"》
《/td》
《/tr》
《/table》
《/td》
《td width=30》
《/td》
《td》
《table》
《tr align=center》
《td》
《input name=k7 type="button" value=" 7 "
onClick="inputkey(’7’)" style="color=blue"》
《/td》
《td》
《input name=k8 type="button" value=" 8 "
onClick="inputkey(’8’)" style="color=blue"》
《/td》
《td》
《input name=k9 type="button" value=" 9 "
onClick="inputkey(’9’)" style="color=blue"》
《/td》
《td》
《input type="button" value=" / "
onClick="operation(’/’,6)" style="color=red"》
《/td》
《td》
《input type="button" value="取余"
onClick="operation(’%’,6)" style="color=red"》
《/td》
《td》
《input type="button" value=" 与 "
onClick="operation(’&’,3)" style="color=red"》
《/td》
《/tr》
《tr align=center》
《td》
《input name=k4 type="button" value=" 4 "
onClick="inputkey(’4’)" style="color=blue"》
《/td》
《td》
《input name=k5 type="button" value=" 5 "
onClick="inputkey(’5’)" style="color=blue"》
《/td》
《td》
《input name=k6 type="button" value=" 6 "
onClick="inputkey(’6’)" style="color=blue"》
《/td》
《td》
《input type="button" value=" * "
onClick="operation(’*’,6)" style="color=red"》
《/td》
《td》
《input name=floor type="button" value="取整"
onClick="inputfunction(’floor’,’deci’)" style="color=red"》
《/td》
《td》
《input type="button" value=" 或 "
onClick="operation(’|’,1)" style="color=red"》
《/td》
《/tr》
《tr align=center》
《td》
《input type="button" value=" 1 "
onClick="inputkey(’1’)" style="color=blue"》
《/td》
《td》
《input name=k2 type="button" value=" 2 "
onClick="inputkey(’2’)" style="color=blue"》
《/td》
《td》
《input name=k3 type="button" value=" 3 "
onClick="inputkey(’3’)" style="color=blue"》
《/td》
《td》
《input type="button" value=" - "
onClick="operation(’-’,5)" style="color=red"》
《/td》
《td》
《input type="button" value="左移"
onClick="operation(’《’,4)" style="color=red"》
《/td》
《td》
《input type="button" value=" 非 "
onClick="inputfunction(’~’,’~’)" style="color=red"》
《/td》
《/tr》
《tr align=center》
《td》
《input type="button" value=" 0 "
onClick="inputkey(’0’)" style="color=blue"》
《/td》
《td》
《input type="button" value="+/-"
onClick="changeSign()" style="color=blue"》
《/td》
《td》
《input name=kp type="button" value=" . "
onClick="inputkey(’.’)" style="color=blue"》
《/td》
《td》
《input type="button" value=" + "
onClick="operation(’+’,5)" style="color=red"》
《/td》
《td》
《input type="button" value=" = "
onClick="result()" style="color=red"》
《/td》
《td》
《input type="button" value="异或"
onClick="operation(’x’,2)" style="color=red"》
《/td》
《/tr》
《tr align=center》
《td》
《input name=ka type="button" value=" A "
onClick="inputkey(’a’)" style="color=blue" disabled=true》
《/td》
《td》
《input name=kb type="button" value=" B "
onClick="inputkey(’b’)" style="color=blue" disabled=true》
《/td》
《td》
《input name=kc type="button" value=" C "
onClick="inputkey(’c’)" style="color=blue" disabled=true》
《/td》
《td》
《input name=kd type="button" value=" D "
onClick="inputkey(’d’)" style="color=blue" disabled=true》
《/td》
《td》
《input name=ke type="button" value=" E "
onClick="inputkey(’e’)" style="color=blue" disabled=true》
《/td》
《td》
《input name=kf type="button" value=" F "
onClick="inputkey(’f’)" style="color=blue" disabled=true》
《/td》
《/tr》
《/table》
《/td》
《/tr》
《/table》
《/td》
《/tr》
《/table》
《/form》
《/div》
《/body》
《/html》
怎么在网页上制作一个简易计算器
(1)先画个页面,把每个数字 运算符号放进去;
(2)然后每个数字 符号绑定一个事件,这个事件获取数字或者符号的值,放进一个Input框;
(3)点击计算,把Input框的字符串表达式计算,eval("1*2");
(4)还有计算前要对表达式进行校验,不规则的表达式不能计算。
我的爸爸的爷爷的爸爸的爸爸是我的什么
爷爷的爸爸称为“曾祖父”,你是爷爷的爸爸的“曾孙/增孙女”
每到过年的时候,一想到要拜访亲戚,是不是就开始头疼如何称呼三大姑四大姨?是不是每次都是乱叫一通,被老妈骂?
今天给你推荐个手机APP神器“亲戚计算器”,将关系输入后,就自动跳出称谓,操作非常的便捷。有了它,再也不用担心叫错人的尴尬了。
亲戚计算器
爷爷的爸爸
希望回答对你有所启发,记得点赞采纳。

更多文章:
搜狗浏览器下载网址(搜狗浏览器官方版下载安装2023 搜狗浏览器2023官方版下载入口)
2025年12月16日 02:00
有谁知道朋友网网页版的网址(手机的)?以前qq有个朋友网哪去了
2026年9月30日 09:20
vip浏览器免费下载(uc浏览器不开通VIp云收藏下载视频要钱吗)
2026年8月30日 17:10
vivo手机怎么更新i主题?MIUI14主题下载的字体在哪个文件夹
2026年5月13日 10:30
xpsp3系统(用电脑硬盘装XPsp3,这样的启动界面,无法进去请指教一下,怎么处理)
2025年7月17日 18:15
极品飞车17最高通缉手机破解版(就大神指导,三星S4怎么安装极品飞车17最高通缉谢谢)
2026年7月18日 03:40
纪念日倒计时软件app(手机桌面日历软件网红日历倒计时软件推荐)
2026年10月15日 13:10


















