1.30 Java周末总结①控制显示多少位小数位②读txt和写txt模拟ATM数据库 一、控制显示多少位小数位 有些时候小数位数太多了,想保留多少位小数,这里介绍一种利用四舍五入保留想要的小数位数Math.round四舍五入到整数位,所以把小数乘以整10或整百,在除以整10或整百,就得到想要的位数了
分类:
数据库 时间:
2016-01-31 02:52:52
阅读次数:
356
Math 提供了大量的数学操作方法 Math类中所有的方法都是static 方法 重点看这个操作,四舍五入 System.out.println(Math.round(-16.5)) ; -16 System.out.println(Math.round(16.5)) ; 17 大于等于0.5进位。
分类:
其他好文 时间:
2016-01-30 22:46:38
阅读次数:
168
#include <stdio.h>#include <math.h> int n,k,num[25],ans; bool Check(int n){ for(int i=2;i<=sqrt(n);i++) if(n%i==0) return false; return true;} void DF
分类:
其他好文 时间:
2016-01-30 22:37:13
阅读次数:
125
_layout: function (dir) { var orientation = this.options.orientation; if (orientation == 'r') { orientation = Math.floor(Math.random() * 2) == 0 ? 'v'
分类:
其他好文 时间:
2016-01-30 17:45:28
阅读次数:
238
购房从银行贷了一笔款d,准备每月还款额为p,月利率为r,计算多少月能还清。d=300000,p=6000,r=1%,对求得的月份取小数点后一位,对第二位小数按四舍五入处理。程序:#include<stdio.h>#include<math.h>intmain(){floatd=300000.0,p=6000.0,r=0.01,m;m=log10(p/(..
分类:
编程语言 时间:
2016-01-30 03:01:43
阅读次数:
1928
作者:zhanhailiang 日期:2014-10-25 使用gcc编译例如以下代码时报“undefined reference to `sin'”: #include <stdio.h> #include <math.h> #include <stdlib.h> main () { double
分类:
其他好文 时间:
2016-01-30 01:47:41
阅读次数:
176
<script> function randomNumber(n, start, end) { var i = 0, arr = []; for (; arr.length < n; i++) { var num = Math.floor(Math.random() * (end - start))
分类:
其他好文 时间:
2016-01-29 16:02:32
阅读次数:
191
<script> function imgCode() { $("#imgCode").on("click", function() { $(this).attr("src", '/user/verify?t=' + Math.random()); }); }; /* 当后台返回验证码错误时,绑定t
分类:
其他好文 时间:
2016-01-29 12:02:22
阅读次数:
141
function drawStar(cxt, x, y, outerR, innerR, rot) { cxt.beginPath(); for (var i = 0; i < 5; i++) { cxt.lineTo(Math.cos((18+i*72-rot)/180*Math.PI)*oute
分类:
Web程序 时间:
2016-01-29 11:59:58
阅读次数:
214
思路:直接暴力枚举区间[l,r]的整数值,然后max和min就可以了。 AC代码: 1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 #include<iostream> 3 #include<cstdio> 4 #include
分类:
其他好文 时间:
2016-01-29 08:41:42
阅读次数:
167