Home » C++ Programming » Basic Syntax » Question
  1. What is the output of this program?
     #include <iostream>
    #include <iomanip>
    using namespace std;
    void showDate(int mm, int dd, int yy)
    {
    cout << setfill('0');
    cout << setw(2) << mm << '/'
    << setw(2) << dd << '/'
    << setw(4) << yy << endl;
    }
    int main()
    {
    showDate(1, 1, 2019);
    return 0;
    }
    1. 01
    2. 01
    3. 2019
    4. 01/01/2019
    5. None of these
Correct Option: D

In this program, We are using the setw function to print the date in correct format.



Your comments will be displayed only after manual approval.