1 year ago

#67357

test-img

Antonio2502

Why does C++ automatically rounds float

I have a code like this...

#include<iostream>
using namespace std;
int main(){

    float num;
    cin >> num;
    cout << num;

return 0;
}

Input: 256.1024

Output: 256.102

Why does C++ automatically rounds my float to three decimals?

c++

floating-point

decimal

rounding

cin

0 Answers

Your Answer

Accepted video resources