Basic Data Types

  • + 38 comments

    Simple :-)

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int a; long b; char c; float d; double e;
        cin>>a>>b>>c>>d>>e;
        cout<<a<<"\n"<<b<<"\n"<<c<<"\n";
        cout<<fixed<<setprecision(3)<<d<<"\n";
        cout<<fixed<<setprecision(9)<<e<<"\n";
        return 0;
    }
    

    And if you want same speed as printf and scanf add these two lines in main just before variable declaration

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);