The method of realizing alarm clock program in C + + _c language

Source: Internet
Author: User

This paper describes the method of realizing the alarm clock program in C + +, the code structure is relatively simple, and the annotation is perfect. We are now sharing them for your reference.

The specific function code is as follows:

#include <iostream> #include <string> #include <ctime> using namespace std;
    Time class time{Private:int hour;
    int minute;
int second;
        Public://Set time void set (int h,int m,int s) {hour = h;
        minute = m;
    Second = s;
        {Next () {if (second<59) second++) ()//Time to go one second, minutes and seconds.
            else if (minute<59) {second=0;
        minute++;}
            else if (hour<23) {minute=0;
        hour++;}
    else hour=0;
    //Get time int getting () {return hour*10000+minute*100+second;
}
};
    Clock class clock{private:time now;
Time Ring_time;
        Public://on the table, set the initial time void Adjust_now (int h,int m,int s) {now.set (h,m,s);
    cout<< "Now the time is:" < 

Interested readers can test and run the instance code, and the lack of functionality can be improved and perfected according to the situation. Hope that this example can help you learn C + + play a certain role.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.