forked from grantrostig/cpp_by_example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
17 lines (14 loc) · 465 Bytes
/
main.cpp
File metadata and controls
17 lines (14 loc) · 465 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float value_f { 1.09 };
float precision { 2 };
cout << value_f*pow(10.0f,precision)-trunc(value_f*pow(10.0f,precision))<<endl;
cout << std::fmod(value_f*pow(10,precision),1)<<endl;
cout << -value_f*pow(10.0f,precision)-trunc(-value_f*pow(10,precision))<<endl;
cout << std::fmod(-value_f*pow(10,precision),1)<<endl;
cout << "Hello World!" << endl;
return 0;
}