#include<windows.h>
void Birthday();
int main()
{
Birthday();
return 0;
}
void Birthday()
{
unsigned frequency[]={392,392,440,392,523,494,
392,392,440,392,587,523,
392,392,784,659,523,494,440,
698,698,659,523,587,523};
unsigned delay[]={375,125,500,500,500,1000,
375,125,500,500,500,1000,
375,125,500,500,500,500,1000,
375,125,500,500,500,1000,};
for(int i=0;i<25;i++)
{
Beep (frequency[i],delay[i]);
}
} ......
1. ½çÃæ¹æ·¶
1.1. ×ÜÌåÔÔò
l ÒÔÓû§ÎªÖÐÐÄ¡£Éè¼ÆÓÉÓû§¿ØÖƵĽçÃ棬¶ø²»ÊǽçÃæ¿ØÖÆÓû§¡£
l Çå³þÒ»ÖµÄÉè¼Æ¡£ËùÓнçÃæµÄ·ç¸ñ±£³ÖÒ»Ö£¬ËùÓоßÓÐÏàͬº¬ÒåµÄÊõÓï±£³ÖÒ»Ö£¬ÇÒÒ×ÓÚÀí½â
l ÓµÓÐÁ¼ºÃµÄÖ±¾õÌØÕ÷¡£ÒÔÓû§ËùÊìϤµÄÏÖʵÊÀ½çÊÂÎñµÄ³éÏóÀ´¸øÓû§°µÊ¾ºÍÒþÓ÷£¬À´°ïÖúÓû§ÄÜѸËÙѧ»áÈí¼þµÄʹÓá£
l ½Ï¿ìµÄÏìÓ¦Ëٶȡ£
l ¼òµ¥ÇÒÃÀ¹Û¡£
1.2. ÔÔòÏêÊö
1.2.1. Óû§¿ØÖÆ
Óû§½çÃæÉè¼ÆµÄÒ»¸öÖØÒªÔÔòÊÇÓû§Ó¦¸Ã×ÜÊǸоõÔÚ¿ØÖÆÈí¼þ¶ø²»ÊǸоõ±»Èí¼þËù¿ØÖÆ¡£
l ²Ù×÷ÉϼÙÉèÊÇÓû§--¶ø²»ÊǼÆËã»ú»òÈí¼þ--¿ªÊ¼¶¯×÷¡£Óû§°çÑÝÖ÷¶¯½ÇÉ«£¬¶ø²»ÊÇ°çÑݱ»¶¯½ÇÉ«¡£ÔÚÐèÒª×Ô¶¯Ö´ÐÐÈÎÎñʱ£¬ÒªÒÔÔÊÐíÓû§½øÐÐÑ¡Ôñ»ò¿ØÖÆËüµÄ·½Ê½À´ÊµÏÖ¸Ã×Ô¶¯ÈÎÎñ¡£
l ÌṩÓû§×Ô¶¨ÒåÉèÖá£ÒòΪÓû§µÄ¼¼ÄܺÍϲºÃ¸÷²»Ïàͬ£¬Òò´ËËûÃDZØÐëÄܹ»¸öÐÔ»¯½çÃæµÄijЩ·½Ãæ¡£WindowsΪÓû§ÌṩÁ˶ÔÐí¶àÕâ·½ÃæµÄ·ÃÎÊ¡£ÄúµÄÈí¼þÓ¦¸Ã·´Ó¦²»Í¬µÄϵͳÊôÐÔ--ÀýÈçÑÕÉ«¡¢×ÖÌå»òÆäËûÑ¡ÏîµÄÓû§ÉèÖá£
l ²ÉÈ¡½»»¥Ê½ºÍÒ×ÓÚ¸ÐÓ¦µÄ´°¿Ú£¬¾¡Á¿±ÜÃâʹÓÃģ̬¶Ô»°¿ò£¬¶øʹÓÃ"·Çģʽ"¸¨Öú´°¿Ú¡£ "ģʽ"ÊÇÒ»ÖÖ״̬£¬ËüÅųýÒ»°ãµÄ½»»¥£¬»òÕßÏÞÖÆÓû§Ö»ÄܽøÐÐÌض¨µÄ½»»¥¡£µ±×îºÃʹÓÃÒ»¸öģʽ»ò¸ÃģʽֻÊÇ¿ÉÌæ»»µÄÉè¼Æʱ--Àý ......
ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©
ÏëÒªÖÕÖ¹Ï̵߳ÄÔËÐУ¬¿ÉÒÔʹÓÃÒÔÏ·½·¨£º
1¡¢Ï̺߳¯Êý·µ»Ø£¨×îºÃʹÓø÷½·¨£©¡£
2¡¢Í¨¹ýµ÷ÓÃExitThreadº¯Êý£¬Ï߳̽«×ÔÐг·Ïû£¨×îºÃ²»Ê¹Óø÷½·¨£©¡£
3¡¢Í¬Ò»¸ö½ø³Ì»òÁíÒ»¸ö½ø³ÌÖеÄÏ̵߳÷ÓÃTerminateThreadº¯Êý£¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
4¡¢ExitProcessºÍTerminateProcessº¯ÊýÒ²¿ÉÒÔÓÃÀ´ÖÕÖ¹Ï̵߳ÄÔËÐУ¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
ÏÂÃ潫Ïêϸ½éÉÜÖÕÖ¹Ïß³ÌÔËÐеķ½·¨£º1-4£¬²¢ËµÃ÷Ïß³ÌÖÕÖ¹ÔËÐÐʱ»á³öÏÖºÎÖÖÇé¿ö£º5¡£
1¡¢Ï̺߳¯Êý·µ»Ø
ʼÖÕ¶¼Ó¦¸Ã½«Ïß³ÌÉè¼Æ³ÉÕâÑùµÄÐÎʽ£¬¼´µ±ÏëÒªÏß³ÌÖÕÖ¹ÔËÐÐʱ£¬ËüÃǾÍÄܹ»·µ»Ø¡£ÕâÊÇÈ·±£ËùÓÐÏß³Ì×ÊÔ´±»ÕýÈ·µØÇå³ýµÄΨһ°ì·¨¡£
Èç¹ûÏß³ÌÄܹ»·µ»Ø£¬¾Í¿ÉÒÔÈ·±£ÏÂÁÐÊÂÏîµÄʵÏÖ£º
£¨1£©ÔÚÏ̺߳¯ÊýÖд´½¨µÄËùÓÐC++¶ÔÏó¾ù½«Í¨¹ýËüÃǵij·Ïûº¯ÊýÕýÈ·µØ³·Ïû¡£
£¨2£©²Ù×÷ϵͳ½«ÕýÈ·µØÊÍ·ÅÏ̶߳ÑջʹÓõÄÄÚ´æ¡£
£¨3£©ÏµÍ³½«Ï̵߳ÄÍ˳ö´úÂ루ÔÚÏ̵߳ÄÄں˶ÔÏóÖÐά»¤£©ÉèÖÃΪÏ̺߳¯ÊýµÄ·µ»ØÖµ¡£
£¨4£©ÏµÍ³½«µÝ¼õÏß³ÌÄں˶ÔÏóµÄʹÓüÆÊý¡£
2¡¢ExitThreadº¯Êý
¿ÉÒÔÈÃÏ̵߳÷ÓÃExitThreadº¯Êý£¬ÒÔ±ãÇ¿ÖÆÏß³ÌÖÕÖ¹ÔËÐУº
º¯ÊýÔÐÍ£º
VOID ExitThread(DWORD dwExitCode);
¸Ãº¯Êý½«ÖÕÖ¹Ï̵߳ÄÔËÐУ¬²¢µ¼Ö² ......
ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©
ÏëÒªÖÕÖ¹Ï̵߳ÄÔËÐУ¬¿ÉÒÔʹÓÃÒÔÏ·½·¨£º
1¡¢Ï̺߳¯Êý·µ»Ø£¨×îºÃʹÓø÷½·¨£©¡£
2¡¢Í¨¹ýµ÷ÓÃExitThreadº¯Êý£¬Ï߳̽«×ÔÐг·Ïû£¨×îºÃ²»Ê¹Óø÷½·¨£©¡£
3¡¢Í¬Ò»¸ö½ø³Ì»òÁíÒ»¸ö½ø³ÌÖеÄÏ̵߳÷ÓÃTerminateThreadº¯Êý£¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
4¡¢ExitProcessºÍTerminateProcessº¯ÊýÒ²¿ÉÒÔÓÃÀ´ÖÕÖ¹Ï̵߳ÄÔËÐУ¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
ÏÂÃ潫Ïêϸ½éÉÜÖÕÖ¹Ïß³ÌÔËÐеķ½·¨£º1-4£¬²¢ËµÃ÷Ïß³ÌÖÕÖ¹ÔËÐÐʱ»á³öÏÖºÎÖÖÇé¿ö£º5¡£
1¡¢Ï̺߳¯Êý·µ»Ø
ʼÖÕ¶¼Ó¦¸Ã½«Ïß³ÌÉè¼Æ³ÉÕâÑùµÄÐÎʽ£¬¼´µ±ÏëÒªÏß³ÌÖÕÖ¹ÔËÐÐʱ£¬ËüÃǾÍÄܹ»·µ»Ø¡£ÕâÊÇÈ·±£ËùÓÐÏß³Ì×ÊÔ´±»ÕýÈ·µØÇå³ýµÄΨһ°ì·¨¡£
Èç¹ûÏß³ÌÄܹ»·µ»Ø£¬¾Í¿ÉÒÔÈ·±£ÏÂÁÐÊÂÏîµÄʵÏÖ£º
£¨1£©ÔÚÏ̺߳¯ÊýÖд´½¨µÄËùÓÐC++¶ÔÏó¾ù½«Í¨¹ýËüÃǵij·Ïûº¯ÊýÕýÈ·µØ³·Ïû¡£
£¨2£©²Ù×÷ϵͳ½«ÕýÈ·µØÊÍ·ÅÏ̶߳ÑջʹÓõÄÄÚ´æ¡£
£¨3£©ÏµÍ³½«Ï̵߳ÄÍ˳ö´úÂ루ÔÚÏ̵߳ÄÄں˶ÔÏóÖÐά»¤£©ÉèÖÃΪÏ̺߳¯ÊýµÄ·µ»ØÖµ¡£
£¨4£©ÏµÍ³½«µÝ¼õÏß³ÌÄں˶ÔÏóµÄʹÓüÆÊý¡£
2¡¢ExitThreadº¯Êý
¿ÉÒÔÈÃÏ̵߳÷ÓÃExitThreadº¯Êý£¬ÒÔ±ãÇ¿ÖÆÏß³ÌÖÕÖ¹ÔËÐУº
º¯ÊýÔÐÍ£º
VOID ExitThread(DWORD dwExitCode);
¸Ãº¯Êý½«ÖÕÖ¹Ï̵߳ÄÔËÐУ¬²¢µ¼Ö² ......
#include <stdio.h>
#include <string.h>
int
main(void)
{
char str[] =
"3BVPSq4xF.K?=u#,"
"G'K<MrDnRr7gH%#,"
"XKf<f%G`w^=?C<#,"
"HgU_AnNR?*PDQU#,"
"1HRmK+7IO2O`Rd#,"
"A,V&M,Jw>!;6P@#,"
"3AScBdQcN41HDc!#";
int i, len;
len = strlen(str);
for (i = 0; i < len; ++i) {
printf("%c", str[i] | 0x80);
if ((i + 1) % 16 == 0)
putchar('\n');
}
putchar('\n');
for (i = 0; i < 7; i++)
printf("%c%c", str[i * 18] | 0x80, str[i * 18 + 1] | 0x80);
putchar('\n');
return 0;
}
ת×Ô:
http://topic.csdn.net/u/20100522/10/60b4502c-121a-4d95-96f9-0acf69e9add1.html
......
#include <stdio.h>
#include <string.h>
int
main(void)
{
char str[] =
"3BVPSq4xF.K?=u#,"
"G'K<MrDnRr7gH%#,"
"XKf<f%G`w^=?C<#,"
"HgU_AnNR?*PDQU#,"
"1HRmK+7IO2O`Rd#,"
"A,V&M,Jw>!;6P@#,"
"3AScBdQcN41HDc!#";
int i, len;
len = strlen(str);
for (i = 0; i < len; ++i) {
printf("%c", str[i] | 0x80);
if ((i + 1) % 16 == 0)
putchar('\n');
}
putchar('\n');
for (i = 0; i < 7; i++)
printf("%c%c", str[i * 18] | 0x80, str[i * 18 + 1] | 0x80);
putchar('\n');
return 0;
}
ת×Ô:
http://topic.csdn.net/u/20100522/10/60b4502c-121a-4d95-96f9-0acf69e9add1.html
......
#include <stdio.h>
#include <string.h>
int
main(void)
{
char str[] =
"3BVPSq4xF.K?=u#,"
"G'K<MrDnRr7gH%#,"
"XKf<f%G`w^=?C<#,"
"HgU_AnNR?*PDQU#,"
"1HRmK+7IO2O`Rd#,"
"A,V&M,Jw>!;6P@#,"
"3AScBdQcN41HDc!#";
int i, len;
len = strlen(str);
for (i = 0; i < len; ++i) {
printf("%c", str[i] | 0x80);
if ((i + 1) % 16 == 0)
putchar('\n');
}
putchar('\n');
for (i = 0; i < 7; i++)
printf("%c%c", str[i * 18] | 0x80, str[i * 18 + 1] | 0x80);
putchar('\n');
return 0;
}
ת×Ô:
http://topic.csdn.net/u/20100522/10/60b4502c-121a-4d95-96f9-0acf69e9add1.html
......