能力值:
( LV4,RANK:50 )
26 楼
没有大神来个ASM版的……
能力值:
( LV2,RANK:10 )
27 楼
为什么要这么黑C和C++
能力值:
( LV3,RANK:20 )
28 楼
都是油菜人呀
能力值:
( LV5,RANK:70 )
29 楼
来个Perl。
#!/usr/bin/perl -w
sub callme{
my $time=time();
my ($a,$b,$c,$d)=localtime($time);
printf "New year :%dday(s)".(' 'x2)."%dhours".(' 'x2)."%dseconds\n",30-$d,24-$c,60-$b;
}
&callme;
能力值:
( LV5,RANK:70 )
30 楼
汇编语言版,32位和64位:
IFNDEF SYSTEMTIME
SYSTEMTIME STRUCT
wYear WORD ?
wMonth WORD ?
wDayOfWeek WORD ?
wDay WORD ?
wHour WORD ?
wMinute WORD ?
wSecond WORD ?
wMilliseconds WORD ?
SYSTEMTIME ENDS
ENDIF
IFDEF _WIN64
;; 64-bit
public _Main
.data
stTime SYSTEMTIME <>
szTxt db 'New Year :%lu %lu %lu',0
szBuf db 260 dup(0)
.code
extrn GetSystemTime: proc
extrn wsprintfA: proc
extrn GetDesktopWindow: proc
extrn ExitProcess: proc
extrn MessageBoxA: proc
_Main:
sub rsp,28H
lea rcx,stTime
call GetSystemTime
mov r8,30
sub r8w,stTime.wDay
mov r9,24
sub r9w,stTime.wHour
mov r10,60
sub r10w,stTime.wMinute
lea rcx,szBuf
lea rdx,szTxt
mov [rsp+20H],r10
call wsprintfA
call GetDesktopWindow
mov rcx,rax
lea rdx,szBuf
lea r8,szBuf
mov r9,40H
call MessageBoxA
xor rcx,rcx
call ExitProcess
ELSE
;; 32-bit
.386
.model flat,stdcall
option casemap:none
.data
stTime SYSTEMTIME <>
szTxt db 'New Year :%lu %lu %lu',0
szBuf db 260 dup(0)
.code
GetSystemTime proto :DWORD
wsprintfA proto C :VARARG
GetDesktopWindow proto
ExitProcess proto :DWORD
MessageBoxA proto :DWORD,:DWORD,:DWORD,:DWORD
public _Main
_Main:
invoke GetSystemTime,offset stTime
mov eax,30
sub ax,stTime.wDay
mov ecx,24
sub cx,stTime.wHour
mov edx,60
sub dx,stTime.wMinute
invoke wsprintfA,offset szBuf,offset szTxt,eax,ecx,edx
invoke GetDesktopWindow
invoke MessageBoxA,eax,offset szBuf,offset szBuf,40H
invoke ExitProcess,0
ENDIF
END
ml /c /coff /nologo ($file)
ml64 /c /nologo /D _WIN64 ($file)
link /subsystem:windows /nologo /entry:_Main ($obj) /defaultlib:"kernel32.lib" /defaultlib:"user32.lib"
能力值:
( LV5,RANK:70 )
31 楼
有人上机器码吗??