#include <iostream>
#include <cstdio> using namespace std; class MyTime
{
private:
int hour;
int minute;
int second;
public:
void SetTime(){cin>>hour>>minute>>second;return;}
void print_12();
void print_24();
}; void MyTime::print_12()
{
if(hour<)
{
printf("%02d:%02d:%02d AM\n",hour,minute,second);
}
else
{
printf("%02d:%02d:%02d PM\n",hour-,minute,second);
}
return;
} void MyTime::print_24()
{
printf("%02d:%02d:%02d\n",hour,minute,second);
return;
} int main()
{
MyTime one;
one.SetTime();
one.print_12();
one.print_24();
return ;
}

设计MyTime类 代码参考的更多相关文章

  1. 设计一个多功能的MyTime类 代码参考

    #include <iostream> #include <cstdio> using namespace std; class MyTime { private: int h ...

  2. 设计Dog类 代码参考

    #include <iostream> #include <string> using namespace std; class Dog { private: string n ...

  3. 设计Person类 代码参考

    #include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...

  4. 设计Weekday类 代码参考

    #include <iostream> using namespace std; class Weekday { private: int num; public: void SetDay ...

  5. 设计带构造函数的Dog类 代码参考

    #include <iostream> #include <string> using namespace std; class Dog { private: string n ...

  6. 设计并测试Trapezium类 代码参考

    #include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...

  7. 从Student类和Teacher类多重派生Graduate类 代码参考

    #include <iostream> #include <cstring> using namespace std; class Person { private: char ...

  8. 从Point类继承的Circle类 代码参考

    #include <iostream> #include <cstring> using namespace std; class Point { private: int x ...

  9. 一个基类Person的多个派生类 代码参考

    #include <iostream> #include <cstring> using namespace std; class Person { protected: ch ...

随机推荐

  1. jquery 根据后端传过来的value值,让小原点根据不同值区间去左右定位

    /** * 小圆点滑动 * @param {目标dom} barEle * @param {最小值} min * @param {最大值} max * @param {dom总长度} domLang ...

  2. 解决虚拟机中linux系统无法使用本机无线wifi联网的问题

    VMware Workstation 在嵌入式开发中经常会遇到,但是显示大多数人使用开发环境是Win10 + 无线网卡,针对这种情况,需要配置虚拟机的上网环境使用的是NAT模式,将配置过程进行描述: ...

  3. docker redis shell

    docker中安装好redis后,运行 docker ps 指令,查看所有运行中的镜像信息 然后运行 docker inspect --format "{{ .State.Pid}}&quo ...

  4. 设计模式之GOF23代理模式02

    静态代理 模拟经纪人与明星开演唱会 public interface Star { /**  * 面谈  */  void confer();  /**   * 签合同   */  void sign ...

  5. about VennsBlog.

    此博客主要将用于记录自己学习路上的一些点滴及心得 同时,也希望各位提出指正 相互交流,共同进步 感谢相遇

  6. 【前端背景UI】鼠标磁性动态蜘蛛网背景源码

    <div style="float:right;" id="hub_iframe"></div> <script type=&qu ...

  7. Java 中的过滤器Filter 和拦截器 Interceptor

    1.先说拦截器 Interceptor 本项目以springboot为例: 新建 InterceptorConfig package com.opendev.mystudy.MyInterceptor ...

  8. Codeforces1138-A(D题)Sushi for Two

    Arkady invited Anna for a dinner to a sushi restaurant. The restaurant is a bit unusual: it offers n ...

  9. python迭代器,生成器

    1. 迭代器 迭代器是访问集合元素的一种方式.迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束.迭代器只能往前不会后退,不过这也没什么,因为人们很少在迭代途中往后退.另外,迭代器的一大 ...

  10. flask之jinjia2模板语言

    flask_jinjia2.py ''' flask中的jinjia2模板语言(和django中模板类似): (1)模板变量{{ }} (2)模板标签{% %} ①for循环遍历 {% for foo ...