用Javascript取float型小数点后两位,例22.127456取成22.13,如何做?
1.这种方法最不推荐:
function get(){
var s = 22.127456 + "";
var str = s.substring(0,s.indexOf(".") + 3);
alert(str);
}
2. 使用正则表达式获取:
function g...
分类:
编程语言 时间:
2014-05-23 08:06:59
阅读次数:
249
#include#include#includevoid main(){//输入行列式开始int
n,i,j,a[20][20],T[20],max[20],b[20],k,q,p,f=2,u=0;float
t[20][20],c,sum=1,w[20];cout>n;ifstream infil...
分类:
其他好文 时间:
2014-05-23 04:28:20
阅读次数:
283
#include#includeusing namespace std;void
main(){//输入行列式开始int n,i,j,a[10][10],T[10],max[10],b[10],k,q,p;float
t[10][10],c,sum=-1;cout>n;cout>a[i][j];}}...
分类:
其他好文 时间:
2014-05-23 04:21:52
阅读次数:
251
#include#include#include#includeusing namespace
std;struct city{char name[50];int jd;int jf;int jm;int wd;int wf;int wm;string
jdf;float a;float b;int...
分类:
其他好文 时间:
2014-05-23 04:20:29
阅读次数:
600
#include
void main(){
const int count = 5;//定义数量
struct student{
char name[80];
float math,eng;
float aver;
}stu[count],temp;
//输入
for (int i = 0; i
scanf("%s%f%f", stu[i].name, &stu[i].m...
分类:
编程语言 时间:
2014-05-22 11:21:15
阅读次数:
312
#include
#include
#include //system(); 这个指令需要用到此头文件
#include //toupper要用到
void main()
{
float value = 1.23456;
printf("%8.1f\n", value);
printf("%8.3f\n", value);
printf("%8.5f\n", value)...
分类:
其他好文 时间:
2014-05-22 09:18:08
阅读次数:
257
先看一段代码实验:#include#includeusing namespace
std;int main(){ unsigned int i = numeric_limits::max(); float f = i; unsigned
int j = (unsigned int ...
分类:
其他好文 时间:
2014-05-22 00:48:31
阅读次数:
286
数据类型
java数据类型基本数据类型数值型整型byte/short/int/long浮点型/double/float字符型char布尔型boolean取值true
false对象数据类型类Class接口 interface数组array[]类型 对象位数字节数最小值最大值byte Byte...
分类:
编程语言 时间:
2014-05-21 22:26:43
阅读次数:
317
IOS 中获取系统版本,比较简单([[UIDevice
currentDevice] systemVersion]);
看到网络上很多转化系统字符串到float 的方法,都是使用 [[[UIDevice currentDevice] systemVersion] floatValue];
但是这个方法我遇到一个问题,就是如果系统版本是7.1.1 的时候,转化生成的float 有问题,我...
分类:
移动开发 时间:
2014-05-20 13:59:59
阅读次数:
282
@interface FoodData : NSObject{ NSString *
foodName; float foodPrice;
}@end/////////////////////////////////////////////////////////////////////////.....
分类:
其他好文 时间:
2014-05-20 11:02:32
阅读次数:
229