Third week project three time

Source: Internet
Author: User

Objective: To Learn Functions

Computer content: Find the added time

/*. * Copyright and version Declaration of the program. * copyright (c) 2013, a student from the computer College of Yantai University. * All rightsreserved .. * file name: text. CPP. * Author: Liu Yujin. * completion date: January 1, March 15, 2013. * version: V1.0. * input Description: Enter the current time. * Problem description: calculate the time in a few seconds. * output: the time after the increase of the output time */# include <iostream> using namespace STD; class time {public: void set_time (); void show_time (); inline void add_a_sec (); inline void add_a_minute (); inline void add_an_hour (); void add_seconds (INT); void add_minut ES (INT); void add_hours (INT); Private: bool is_time (INT, Int, INT); int hour; int minute; int sec;}; void time :: set_time () {char C1, C2; cout <"Enter the time (Format: hh: mm: SS)"; while (1) {CIN> hour> C1> minute> c2> sec; If (C1! = ':' | C2! = ':') The cout <"format is incorrect. Enter" <Endl; else if (! Is_time (hour, minute, Sec) cout <"invalid time. Enter" <Endl; elsebreak ;}} void time: show_time () {cout 

Running result:

Experience: As a matter of fact, with the previous foundation, you can refer to the research and take a long time to find that the functions are almost the same, but there are differences between hours and minutes ,,,,,

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.