flash时钟代码
时针:onClipEvent(enterFrame)//当进入时针这个影片剪辑的帧时{
timeNow=new Date(); //定义一个叫timeNow的时间对象
this._rotation=(timeNow.getHours()%12+timeNow.getMinutes()/60)*30;
//时针这个影片剪辑旋转的角度=(当前系统时间整除12+当前分钟数除以60)*30度
以下:分钟和秒钟如同,
百分号是整除的意思。
c++时钟程序代码
用c++的话还是弄成类比较好的,下面是我的解决方法:
#include <ctime>
#include <cstring>
class Timer
{
private:
static const int size = 50;
std::time_t time;
std::tm localTime;
char Ascll[size];
char flag;
public:
Timer()
{
std::time(&time);
flag = 0;
}
~Timer() {}
const char* printTime()
{
if(!flag)
{
localTime = *std::localtime(&time);
std::strcpy(Ascll, std::asctime(&localTime));
}
flag++;
return Ascll;
}
double timeDiff(Timer* time2) const
{
return difftime(time, time2 -> time);
}
} ;
int main()
{
Timer t1;
for(int i = 0; i < 10000; i++ )
{
cout << i;
}
Timer t2;
std::cout << t1.printTime() << std::endl;
std::cout << t2.printTime() << std::endl;
std::cout << t2.timeDiff(&t1) << std::endl;
return 0;
}c语言时钟代码
#include<graphics.h> /* 引入graphic.h */
#include<math.h> /* 引入math.h */
#include<dos.h> /* 引入dos.h */
#define pi 3.1415926 /*定义pi=3.14159*/
#define X(a,b,c) x=a*cos(b*c*pi/180-pi/2)+300;
#define Y(a,b,c) y=a*sin(b*c*pi/180-pi/2)+240;
#define d(a,b,c) X(a,b,c);Y(a,b,c);line(300,240,x,y) /*定义……*/
void init() /*初始化程序*/
{int i,l,x1,x2,y1,y2; /*定义……*/
setbkcolor(1); /*设置颜色*/
circle(300,240,200); /*作园*/
circle(300,240,205);
circle(300,240,5);
for(i=0;i<60;i++) /*循环(算时间)*/
{if(i%5==0) l=15;
else l=5;
x1=200*cos(i*6*pi/180)+300;
y1=200*sin(i*6*pi/180)+240;
x2=(200-l)*cos(i*6*pi/180)+300;
y2=(200-l)*sin(i*6*pi/180)+240;
line(x1,y1,x2,y2);
}
}
main()
{
int x,y;
int gd=VGA,gm=2;
unsigned char h,m,s; /*定义*/
struct time t[1];
initgraph(&gd,&gm,"d:\tc");
init();
setwritemode(1);
gettime(t);
h=t[0].ti_hour;
m=t[0].ti_min;
s=t[0].ti_sec; /*定义时分秒*/
setcolor(7); /*设置颜色*/
d(150,h,30);
setcolor(14);
d(170,m,6);
setcolor(4);
d(190,s,6);
while(!kbhit()) /*获取键盘相应*/
{while(t[0].ti_sec==s)
gettime(t); /*C语言中得到时间的函数*/
sound(400); /*计算时间……*/
delay(70);
sound(200);
delay(30);
nosound();
setcolor(4);
d(190,s,6);
s=t[0].ti_sec;
d(190,s,6);
if (t[0].ti_min!=m)
{
setcolor(14);
d(170,m,6);
m=t[0].ti_min;
d(170,m,6);
}
if (t[0].ti_hour!=h)
{ setcolor(7);
d(150,h,30);
h=t[0].ti_hour;
d(150,h,30);
sound(1000);
delay(240);
nosound();
delay(140);
sound(2000);
delay(240);
nosound();
}
}
getch(); /*设置空格后退出*/
closegraph();
}
具体的。
。
就是套用用几个函数算时间。
。
不要对这种很长的东西害怕,其实大部分都是在画这个钟~
加油哦~网页时钟代码
<html>
<head>
<script language="vbscript">
dim y,m,d,w,ww
y=Year(Date)
m=Month(Date)
d=Day(Date)
w=WeekDay(Date)
select case w
case 1
ww="星期日"
case 2
ww="星期一"
case 3
ww="星期二"
case 4
ww="星期三"
case 5
ww="星期四"
case 6
ww="星期五"
case 7
ww="<font color=red>星期日</font>"
end select
sub tt()
bb.innerHTML=cstr(time)
call setTimeout("tt()",1000)
end sub
</script>
</head>
<body onLoad="tt()">
<script language="vbscript">
document.write("今天是 "&y&"年"&m&"月"&d&"日 "&ww&"<br>")
</script>
现在的时间是:<span id="bb"></span>
</body>
</html>
tmhhost怎么样?tmhhost正在搞暑假大促销活动,全部是高端线路VPS,现在直接季付8折优惠,活动截止时间是8月31日。可选机房及线路有美国洛杉矶cn2 gia+200G高防、洛杉矶三网CN2 GIA、洛杉矶CERA机房CN2 GIA,日本软银(100M带宽)、香港BGP直连200M带宽、香港三网CN2 GIA、韩国双向CN2。点击进入:tmhhost官方网站地址tmhhost优惠码:Tm...
收到好多消息,让我聊一下阿里云国际版本,作为一个阿里云死忠粉,之前用的服务器都是阿里云国内版的VPS主机,对于现在火热的阿里云国际版,这段时间了解了下,觉得还是有很多部分可以聊的,毕竟,实名制的服务器规则导致国际版无需实名这一特点被无限放大。以前也写过几篇综合性的阿里云国际版vps的分析,其中有一点得到很多人的认同,那句是阿里云不管国内版还是国际版的IO读写速度实在不敢恭维,相对意义上的,如果在这...
便宜的香港vps多少钱?现在国外VPS主机的价格已经很便宜了,美国VPS主机最低一个月只要十几元,但同样免备案的香港VPS价格贵不贵呢?或者说便宜的香港VPS多少钱?香港vps主机价格要比美国机房的贵一些,但比国内的又便宜不少,所以目前情况是同等配置下,美国VPS比香港的便宜,香港VPS比国内(指大陆地区)的便宜。目前,最便宜香港vps低至3元/首月、18元/月起,今天云服务器网(www.yunt...
时钟代码为你推荐
npm安装如何安装solarwinds日本名字大全日本动漫人物名字大全linux开放8080端口怎么在linux 打开80端口linux开放8080端口linux 如何将本地80端口的请求转发到8080端口,当前主机IP为192.168.2.1华为云服务找回手机我的华为手机丢了但是在处于关机状态怎么找回呢bandwagonstation wagon是什么意思cdn是什么意思阿里流量包是什么意思云服务器和虚拟主机的区别服务器和主机有什么区别呀?安徽服务器租用服务器托管的话,安徽地区的费用大概多少?域名分类域名的基本类型有哪些?
虚拟主机系统 安徽虚拟主机 域名网 游戏服务器租用 绍兴服务器租用 代理域名备案 ipage 阿里云os l5520 便宜建站 国外免费空间 php免费空间 天互数据 河南移动邮件系统 腾讯云分析 中国电信测网速 789 免费php空间 腾讯网盘 万网服务器 更多