Basic Data Types

  • + 0 comments

    include

    include // Include for setting precision

    using namespace std;

    int main() { int integer; long longValue; char character; float floatingPoint; double doubleValue;

    // Input reading
    cin >> integer >> longValue >> character >> floatingPoint >> doubleValue;
    
    // Output with proper formatting
    cout << integer << endl;
    cout << longValue << endl;
    cout << character << endl;
    cout << fixed << setprecision(3) << floatingPoint << endl; // Set float precision to 3 decimal places
    cout << fixed << setprecision(9) << doubleValue << endl;   // Set double precision to 9 decimal places
    
    return 0;
    

    }