close

#include <iostream>
using namespace std;

struct Time
{
    int minutes;
    int hours;
    int seconds;
};

Time settime();
void showsecond(const Time &now);

int main()
{
    Time t = { 0,0,0 };
    t = settime();
    showsecond(t);
    system("pause");
    return 0;
}

Time settime()
{
    Time now;
    cout << "setting your time" << endl;
    cout << "enter your hours :" << endl;
    cin >> now.hours;
    cout << "enter your minutes :" << endl;
    cin >> now.minutes;
    cout << "enter your seconds :" << endl;
    cin >> now.seconds;

    return now;
}

void showsecond(const Time &now)
{
    int seconds = 0;
    seconds = now.hours * 3600 + now.minutes * 60 + now.seconds;
    cout << "total seconds of today :" <<seconds<< endl;

}

arrow
arrow
    全站熱搜

    異想人 發表在 痞客邦 留言(0) 人氣()