算术运算符

&nbs

HTML Tags and JavaScript tutorial



算术运算符





import java.awt.*;
import java.applet.Applet;
 
public class ArithmeticOperation extends Applet
{
    int i_x=1;
    int i_y=2;
    double d_x=3.1415926;
    double d_y=2.41;
  
    public void paint(Graphics g)
     {
       g.drawString(i_x+"+"+i_y+"="+(i_x+i_y),10,20);           //10 ,20分别表示蘅众坐标位子
       g.drawString(i_x+"-"+i_y+"="+(i_x-i_y),10,40); 
       g.drawString(i_x+"*"+i_y+"="+(i_x*i_y),10,60);
       g.drawString(i_x+"/"+i_y+"="+(i_x/i_y),10,80);
       g.drawString(i_x+"%"+i_y+"="+(i_x%i_y),10,100);
       g.drawString(d_x+"+"+d_y+"="+(d_x+d_y),10,140);
       g.drawString(d_x+"-"+d_y+"="+(d_x-d_y),10,160);
       g.drawString(d_x+"*"+d_y+"="+(d_x*d_y),10,180);
       g.drawString(d_x+"/"+d_y+"="+(d_x/d_y),10,200);
       g.drawString(d_x+"%"+d_y+"="+(d_x%d_y),10,220); 
用最简单的方法创建html文件 -----只需更改 标题名为ArithmeticOperation 
/
code=ArithmeticOperation
<html>
<head><title>ArithmeticOperation</title></head>
<body>
<hr>
<applet code=ArithmeticOperation
width=510   height=200>
</applet>
</body>
</html>
运行C:/>AppletViewer ArithmeticOperation.html
 可得结果


p;
阅读更多
上一篇Marketiva平台简介
下一篇标日第一课
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭