Redian新闻
>
Anybody here has experience doing photometric plan
avatar
Anybody here has experience doing photometric plan# CivilEngineering - 土木工程
i*i
1
突然想到的问题,应该是可行的吧,如果只做点最简单的个人介绍的页面啊什么的。不
过好像国内把dropbox也给墙了?
avatar
w*g
2
比如说100.0000,我希望输出100. (保留小数点,但是不输出后面的0).搞了好久没发
搞定,希望版上有高人能解决这个问题。
avatar
f*n
3
Using AGI32 or Dialux?
avatar
r*y
4
五月就封了
amazon的s3现在还没封

【在 i**i 的大作中提到】
: 突然想到的问题,应该是可行的吧,如果只做点最简单的个人介绍的页面啊什么的。不
: 过好像国内把dropbox也给墙了?

avatar
B*e
5
google it, you are so lazy.
http://web.cs.wpi.edu/~cs1005/common/floatformats.html

【在 w***g 的大作中提到】
: 比如说100.0000,我希望输出100. (保留小数点,但是不输出后面的0).搞了好久没发
: 搞定,希望版上有高人能解决这个问题。

avatar
w*g
6
这个页面上这些我都知道,Google和C++手册我也查过,但都不解决问题。下面是我的测
试程序。我希望的输出是
1. Hello, world!
但是事实上我得到的是
1.000000 Hello, world!
setprecision在这儿没用,因为如果我用setprecision(1),则打印3.14的时候就会精
度不够。我需要产生一个MPS输入文件,所以才需要用到这么变态的格式。其实多加几
个0没什么区别,只是C++的格式化I/O不能做到某些事情让我很不爽。
#include
#include
using namespace std;
int main ()
{
cout << left << fixed << showpoint << setw(12);
cout << 1.0 << "Hello, world!" << endl;
return 0;
}

【在 B********e 的大作中提到】
: google it, you are so lazy.
: http://web.cs.wpi.edu/~cs1005/common/floatformats.html

avatar
B*e
7

的测
If this is the case, you have to write a conversion function yourself.
in C, you use printf("%.0f",a) to generate the result. This is the same as
setprecision.

【在 w***g 的大作中提到】
: 这个页面上这些我都知道,Google和C++手册我也查过,但都不解决问题。下面是我的测
: 试程序。我希望的输出是
: 1. Hello, world!
: 但是事实上我得到的是
: 1.000000 Hello, world!
: setprecision在这儿没用,因为如果我用setprecision(1),则打印3.14的时候就会精
: 度不够。我需要产生一个MPS输入文件,所以才需要用到这么变态的格式。其实多加几
: 个0没什么区别,只是C++的格式化I/O不能做到某些事情让我很不爽。
: #include
: #include

avatar
P*e
8
这个是正解
c++里面什么setwidth, setprecision,我以前都试过,不知道为什么和网上一样的程序
我就是用VC,g++都跑不出他们的结果
不知道谁能解释一下

as

【在 B********e 的大作中提到】
:
: 的测
: If this is the case, you have to write a conversion function yourself.
: in C, you use printf("%.0f",a) to generate the result. This is the same as
: setprecision.

avatar
t*t
9
use setprecision(0), obviously not setprecision(1)
the default precision is 6, so you must set it
to summerize, you need
cout<
的测

【在 w***g 的大作中提到】
: 这个页面上这些我都知道,Google和C++手册我也查过,但都不解决问题。下面是我的测
: 试程序。我希望的输出是
: 1. Hello, world!
: 但是事实上我得到的是
: 1.000000 Hello, world!
: setprecision在这儿没用,因为如果我用setprecision(1),则打印3.14的时候就会精
: 度不够。我需要产生一个MPS输入文件,所以才需要用到这么变态的格式。其实多加几
: 个0没什么区别,只是C++的格式化I/O不能做到某些事情让我很不爽。
: #include
: #include

avatar
t*t
10
比如说什么网上的程序呢?
C++的iostream是做得一般, 但是文档里有的还是可以做到的

【在 P********e 的大作中提到】
: 这个是正解
: c++里面什么setwidth, setprecision,我以前都试过,不知道为什么和网上一样的程序
: 我就是用VC,g++都跑不出他们的结果
: 不知道谁能解释一下
:
: as

avatar
w*g
11
还是thrust老大牛

【在 t****t 的大作中提到】
: use setprecision(0), obviously not setprecision(1)
: the default precision is 6, so you must set it
: to summerize, you need
: cout<:
: 的测

avatar
P*e
12
比如你setwidth(5)
你可以试试结果

【在 t****t 的大作中提到】
: 比如说什么网上的程序呢?
: C++的iostream是做得一般, 但是文档里有的还是可以做到的

avatar
B*e
13
dude. 3.14 will print like 3.
For flexibility, write your own function.

【在 w***g 的大作中提到】
: 还是thrust老大牛
avatar
t*t
14
well, you have to specify a precision for every number, don't you?
3.14 can't even be represented in finite precision anyway, so given 3.14, the computer don't know it's 3.14 or 3.140 or 3.1400. *you* have to tell the computer to print how many digits. Unless you say, "keep all trailing non-zero but omit zero, up to so many digits", but none of the standard library in any language (to the best of my knowledge) will give you this, you have to write your own function.

【在 B********e 的大作中提到】
: dude. 3.14 will print like 3.
: For flexibility, write your own function.

avatar
f*y
15
cout.presicion(0);
avatar
a*9
16
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。