64,654
社区成员
发帖
与我相关
我的任务
分享
char *b=new char[5];
b[0] = 'P';
b[1] = 'b';
b[2] = 'c';
b[4] = 'E';
cout<<b<<endl;
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float a= 1.0;
float b= 3.0;
double c = 1.0;
double d = 3.0;
cout << fixed << setprecision(50) << a/b << endl;
cout << fixed << setprecision(50) << c/d << endl;
return 0;
}
int *n=new int[3];
n[0]=100;
n[2]=200;
cout<<n[1]<<endl;
输出一个较大数字,且多次运行,这个数字还不同
2# @棉猴,“b[3]b[4]两个值合起来”,还是疑惑,为什么前面的b[0]b[1]b[2]就没合。这个在解释乱码问题
问题3、如下代码
float f1=10.0;
float f2=3.0;
cout<<"float output:"<<f1/f2<<endl;
double d1=10.0;
double d2=3.0;
cout<<"double output:"<<d1/d2<<endl;
输出的都是3.33333,我意思是对double,尾部应该有更多个3(小数部分)。难道是输出显示成这样了
问题3、确认是64位win7,long和int一样可放的最大数是10位数(21....)
至于long最大19位,是用(numeric_limits<long>::max)()得出的