设计MyTime类 代码参考
#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类 代码参考的更多相关文章
- 设计一个多功能的MyTime类 代码参考
#include <iostream> #include <cstdio> using namespace std; class MyTime { private: int h ...
- 设计Dog类 代码参考
#include <iostream> #include <string> using namespace std; class Dog { private: string n ...
- 设计Person类 代码参考
#include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...
- 设计Weekday类 代码参考
#include <iostream> using namespace std; class Weekday { private: int num; public: void SetDay ...
- 设计带构造函数的Dog类 代码参考
#include <iostream> #include <string> using namespace std; class Dog { private: string n ...
- 设计并测试Trapezium类 代码参考
#include <iostream> using namespace std; class Trapezium { private: int x1,y1,x2,y2,x3,y3,x4,y ...
- 从Student类和Teacher类多重派生Graduate类 代码参考
#include <iostream> #include <cstring> using namespace std; class Person { private: char ...
- 从Point类继承的Circle类 代码参考
#include <iostream> #include <cstring> using namespace std; class Point { private: int x ...
- 一个基类Person的多个派生类 代码参考
#include <iostream> #include <cstring> using namespace std; class Person { protected: ch ...
随机推荐
- Codeforces Round #637 (Div. 2) 题解
A. Nastya and Rice 网址:https://codeforces.com/contest/1341/problem/A Nastya just made a huge mistake ...
- MySQL导出数据到文件中的方法
MySQL导出数据到文件中的方法 1.导出数据到txt文件中实例:把数据表studscoreinfo中所有数据导出到指定的位置方法:select * from 表名 into outfile 指定导出 ...
- 消息队列,RabbitMQ、Kafka、RocketMQ
目录 1.消息列队概述 1.1消息队列MQ 1.2AMQP和JMS 1.2.1AMQP 1.2.2JMS 1.2.3AMOP 与 JMS 区别 1.3消息队列产品 1.3.1 Kafka 1.3.2 ...
- 学习vue第五节,vue中使用class和style的css样式
vue中使用class样式 数组 <h1 :class="['red', 'thin']">这是一个H1</h1> 数组中使用三元表达式 <h1 :c ...
- 安装MySQL8(附详细图文)
安装MySQL8(附详细图文) 删除mysql服务:mysqld -remove mysql 1.下载 mysql 8 下载地址:https://dev.mysql.com/downloads/mys ...
- while持续输入的几种常用使用方法
while(scanf("%d,&n")!=EOF) 如果n被成功读入,则返回值为1, 如果n未被成功读入,则返回值为0, 如果遇到错误或遇到end of file,返回值 ...
- java读源码 之 queue源码分析(PriorityQueue,附图)
今天要介绍的是基础容器类(为了与并发容器类区分开来而命名的名字)中的另一个成员--PriorityQueue,它的大名叫做优先级队列,想必即使没有用过也该有所耳闻吧,什么?没..没听过?emmm... ...
- 【Spark】不熟悉Spark-shell常用参数?这一张图就够了
- k近邻法(二)
上一篇文章讲了k近邻法,以及使用kd树构造数据结构,使得提高最近邻点搜索效率,但是这在数据点N 远大于 2^n 时可以有效的降低算法复杂度,n为数据点的维度,否则,由于需要向上回溯比较距离,使得实际效 ...
- 新创建的项目AndroidManifast报App is not indexable by Google Search;
原错误提示:App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VI ...