View Code of Problem 3310

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int y, mouth, d, h, m, s;
        char ch;
        cin >> y >> ch >> mouth >> ch >> d >> ch >> h >> ch >> m >> ch >> s;
        if (h>12)
        {
            cout << setw(2) << setfill('0') << mouth << "/";
            cout << setw(2) << setfill('0') << d << "/";
            cout << y << "-";
            cout << setw(2) << setfill('0') << h - 12 << ":";
            cout << setw(2) << setfill('0') << m << ":";
            cout << setw(2) << setfill('0')<<s << "pm" << endl;

        }
        else if (h==0)
        {
            cout << setw(2) << setfill('0') << mouth << "/";
            cout << setw(2) << setfill('0') << d << "/";
            cout << y << "-";
            cout << setw(2) << setfill('0') << h + 12 << ":";
            cout << setw(2) << setfill('0') << m << ":";
            cout << setw(2) << setfill('0') << s << "am" << endl;

        }
        else
        {
            cout << setw(2) << setfill('0') << mouth << "/";
            cout << setw(2) << setfill('0') << d << "/";
            cout << y << "-";
            cout << setw(2) << setfill('0') << h  << ":";
            cout << setw(2) << setfill('0') << m << ":";
            cout << setw(2) << setfill('0') << s << "am" << endl;

        }

    }
}
/*
F:\temp\22496752.30282\Main.cc:2:24: error: bits/stdc++.h: No such file or directory
F:\temp\22496752.30282\Main.cc: In function 'int main()':
F:\temp\22496752.30282\Main.cc:8: error: 'cin' was not declared in this scope
F:\temp\22496752.30282\Main.cc:16: error: 'cout' was not declared in this scope
F:\temp\22496752.30282\Main.cc:16: error: 'setw' was not declared in this scope
F:\temp\22496752.30282\Main.cc:16: error: 'setfill' was not declared in this scope
F:\temp\22496752.30282\Main.cc:21: error: 'endl' was not declared in this scope
F:\temp\22496752.30282\Main.cc:26: error: 'cout' was not declared in this scope
F:\temp\22496752.30282\Main.cc:26: error: 'setw' was not declared in this scope
F:\temp\22496752.30282\Main.cc:26: error: 'setfill' was not declared in this scope
F:\temp\22496752.30282\Main.cc:31: error: 'endl' was not declared in this scope
F:\temp\22496752.30282\Main.cc:36: error: 'cout' was not declared in this scope
F:\temp\22496752.30282\Main.cc:36: error: 'setw' was not declared in this scope
F:\temp\22496752.30282\Main.cc:36: error: 'setfill' was not declared in this scope
F:\temp\22496752.30282\Main.cc:41: error: 'endl' was not declared in this scope
*/

Double click to view unformatted code.


Back to problem 3310