Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- class Time{
- public:
- int min;
- int hour;
- Time(int min = 0, int hour = 0){
- if (min >= 0) {
- if (min > 59) { min = 0; }
- }
- else{ min = 0; }
- if (hour >= 0) {
- if (hour > 23) { hour = 0; }
- }
- else { hour = 0; }
- }
- int setTime(int x, int y){
- min = x;
- hour = y;
- if (x >= 0) {
- if (x > 59) { min = 0; }
- }
- else{ min = 0; }
- if (y >= 0) {
- if (hour > 23) { hour = 0; }
- }
- else { hour = 0; }
- return min, hour;
- }
- void showTime(){
- cout << setfill('0');
- cout << setw(2) << hour << ":" << setw(2) << min << endl;
- }
- Time copyTime(Time x){
- }
- };
- int main(){
- Time t1;
- t1.setTime(2, 3);
- t1.showTime();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement