| test1.cpp |
// test1.cpp
// g++ -o test1 test1.cpp
#include <iostream>
using namespace std;
int main(void)
{
int N = 3;
cout << 1 / N << endl;
cout << 1.0 / N << endl;
cout << 1 / (double) N << endl;
cout << (double) 1 / N << endl;
cout << double(1) / N << endl;
cout << 1 / double(N) << endl;
return 0;
}
|
| test1 の結果 |
[katsurada-no-MacBook-Air-4:~/work/tmp] mk% ./test1 0 0.333333 0.333333 0.333333 0.333333 0.333333 [katsurada-no-MacBook-Air-4:~/work/tmp] mk% |
桂田 祐史