模拟数字式时钟
来源:互联网 发布:c语言打开文件目录 编辑:程序博客网 时间:2024/05/01 14:58
#include<iostream>
#include<windows.h>
using namespace std;
class Cicle{
public:
Cicle(int x)
{
curr=x;
}
int get()
{
return curr;
}
int curr;
};
class Clock{
private:
int clock;//时
Cicle c1;//分
Cicle c2;//秒
public:
Clock(int h,int m,int s):c1(m),c2(s){
clock=h;
}
int geth()
{
return clock;
}
void displayTime()
{
while(1)
{
cout<<clock<<":"<<c1.curr<<":"<<c2.curr<<endl;
Sleep(1000);
system("cls");
if(!(c2.curr=++c2.curr%60))
if(!(c1.curr=++c1.curr%60))
clock=++clock%24;
}
}
};
int main()
{
Clock CLOCK(23,59,59);
CLOCK.displayTime();
return 0;
}
#include<windows.h>
using namespace std;
class Cicle{
public:
Cicle(int x)
{
curr=x;
}
int get()
{
return curr;
}
int curr;
};
class Clock{
private:
int clock;//时
Cicle c1;//分
Cicle c2;//秒
public:
Clock(int h,int m,int s):c1(m),c2(s){
clock=h;
}
int geth()
{
return clock;
}
void displayTime()
{
while(1)
{
cout<<clock<<":"<<c1.curr<<":"<<c2.curr<<endl;
Sleep(1000);
system("cls");
if(!(c2.curr=++c2.curr%60))
if(!(c1.curr=++c1.curr%60))
clock=++clock%24;
}
}
};
int main()
{
Clock CLOCK(23,59,59);
CLOCK.displayTime();
return 0;
}
0 0
- 模拟数字式时钟
- 用全局变量编程模拟显示一个数字式时钟(习题7.2)
- 模拟时钟
- 模拟时钟
- 模拟时钟
- 模拟时钟
- 模拟时钟
- 模拟时钟
- 模拟时钟,让时钟走动
- js模拟时钟代码
- 模拟小时钟源代码
- c语言模拟时钟
- Java模拟时钟
- Java模拟时钟
- css3模拟时钟
- javascript 案例:模拟时钟
- QT模拟时钟程序
- 模拟时钟的实现
- HashMap解决hash冲突的方法
- Android Xml的解析
- 自旋锁、互斥锁和信号量的区别
- Golang RPC性能测试
- 静态初始板块,构造方法和初始板块它们之间的执行优先级
- 模拟数字式时钟
- Linux(CentOS)下,下载安装Nginx并配置
- js给网页中所有p元素添加onclick事件
- hdu 3549 网络流 模板题
- 1102. Invert a Binary Tree (25)
- Volley源码解析
- nodejs&&git&&cmd&&npm代理及仓库配置
- Java并发编程系列之二:重排序与顺序一致性
- vb hair (发)