C++ question!

2006-12-24 10:01 pm
what the different between
"double a=3" and
"double a=3.0"?

回答 (1)

2006-12-25 6:50 pm
✔ 最佳答案
Please try out the following testing program, and you will see the "difference"!

#include
#include
using namespace std;

void main() {
double a=3;
double b=3.0;
cout << "a = " << a << endl;
cout << "b = " << b << endl;
printf("a = %f\n", a);
printf("b = %f\n", b);
}

The output is :

a = 3
b = 3
a = 3.000000
b = 3.000000


收錄日期: 2021-04-13 01:01:40
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20061224000051KK01857

檢視 Wayback Machine 備份