Basic Data Types

  • + 0 comments

    /* The Question Should Have Specified That We Need To Set Precision For The Values Of Float & Double, I just wrote the simpler code like everyone and It did not work on the other test questions, I tried the questions 4-5 Times until I realised My code was not printing decimal values after some 3 or 4 digits then I came to know that I do have to set a precision value which I ultimately had to and I didn't how to, Googled It, learned something new from this question, here's my solution. */

    include

    include

    include

    using namespace std; int main() { int x; long y; char a; float z; long double d; cin >> x; cin >> y; cin >> a; cin >> z; cin >> d; cout << x <<"\n"; cout << y <<"\n"; cout << a <<"\n"; cout << fixed << setprecision(3)<< z <<"\n"; cout << fixed << setprecision(9)<< d <<"\n";

    return 0;
    

    }