【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《生日快乐代码》,欢迎阅读!
生日快乐代码
#include #include
DWORD WINAPI play_music(PVOID pParam); DWORD WINAPI pray(PVOID pParam); unsigned int rhythm[] = {
0x188, 0x188, 0x1B8, 0x188, 0x20B, 0x1EE,0x188, 0x188, 0x1B8, 0x188, 0x24B, 0x20B,0x188, 0x188, 0x310, 0x293, 0x20B, 0x1EE,0x1B8, 0x2BA, 0x2BA, 0x293, 0x20B, 0x24B,0x20B
};
unsigned int delay[] = {
0x177, 0x07D, 0x1F4, 0x1F4, 0x1F4, 0x3E8,0x177, 0x07D, 0x1F4, 0x1F4, 0x1F4, 0x3E8,0x177, 0x07D, 0x1F4, 0x1F4, 0x1F4, 0x1F4, 0x3E8,0x177, 0x07D, 0x1F4, 0x1F4, 0x1F4, 0x3E8,};
void main() {
HANDLE threadTest[2]; int i=1,j=2;
threadTest[0]=CreateThread(NULL,0,play_music,NULL,0,0); threadTest[1]=CreateThread(NULL,0,pray,NULL,0,0); WaitForMultipleObjects(2,threadTest,true,INFINITE); }
DWORD WINAPI play_music(PVOID pParam) {
int i = 0; for(; i < 25; ++i) {
Beep(rhythm[i]*5, delay[i]); if(i == 24) {
Sleep(500); i = 0; } } return 0; }
DWORD WINAPI pray(PVOID pParam){ int i=0;
char c[]=" 亲,今天是你的生日,Happy Birthday:愿所有的快,所 亲亲亲有的幸福,所有的温馨,所有的好运永在你身亲亲亲亲亲亲亲! O(?_?)O";
system("color 5e"); printf("\n\n\n");
printf(" \n"); printf(" \n");??
printf(" %s \n", "XXX");?? printf(" ?生日快?亲 \n"); printf(" \n");??
printf(" \n");printf("\n\n");
for(i=0;i<56;i++) {
printf("%c",c[i]); Sleep(100); }
printf("\n\n"); Sleep(100);
for(i=56;i<135;i++) {
printf("%c",c[i]); Sleep(100); }
printf("\n\n"); system("pause"); return 0; }
本文来源:https://www.wddqxz.cn/f1ffa4ec78563c1ec5da50e2524de518974bd37b.html