CÓïÑÔµÄÒ»¸ö¼òµ¥Ëã·¨: 26¸ö×ÖĸËæ»ú²½Éú³É
Ò»¸ö¼òµ¥µÄС³ÌÐò, ÔÌâÄ¿¼û<CÓïÑÔ³ÌÐòÉè¼Æ-ÏÖ´ú·½·¨>µÚ°ËÕÂÁ·Ï°13.
ÓÉÓÚ×Ô¼ºÖ»¿´µ½µÚ°ËÕÂ, ËùÒÔ, ²»¸ÒóȻʹÓú¯ÊýµÈÆäËûÄÚÈÝ, ¸ßÊÖÇë·ÅÉù´óЦ.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define ROWS 10
#define COLS 10
/**
* @author: selfimpr
* @blog: http://blog.csdn.net/lgg201
* @email: lgg860911@yahoo.com.cn
* ¹¦ÄÜ:
* ROWS * COLSµÄ·½¸ñÖÐʵÏÖËæ»ú²½. ¼´½«26¸ö´óд×Öĸ°´Ë³ÐòÒÔËæ»úµÄ·½ÏòÅÅÁÐ.
* ÕâÀïʵÏÖµÄÊǰ˸ö·½Ïò(º¹, ²»ÖªµÀÓÐûÓа˸ö·½Ïòһ˵.)
* ȱÏÝ:
* Óнϴó¼¸Âʱ»À§ËÀ, ûÓÐ×öÓÅ»¯´¦Àí.
* Êý¾Ý½á¹¹Éè¼Æ:
* 1. ROWS, COLSºê¶¨ÒåÁËÆåÅ̵ĴóС
* 2. board¶þάÊý×鶨ÒåÁËÆåÅÌ, ûÓÐ×ÖĸµÄÒÔ.ºÅ²¹¿Õ
* 3. i, jΪѻ·Òò×Ó, ÔÚ·½Ïò¿ØÖÆʱ, ³äµ±ÁËÒƶ¯µÄ·½Ïò¿ØÖÆ.
* 4. directionΪ·½Ïò¿ØÖƱäÁ¿.
* 5. chÊÇ˳Ðò»ñÈ¡×ÖĸµÄÑ»·Òò×Ó.
* 6. row, col´æ´¢ÁÙʱµÄÒƶ¯×ø±ê, ´æ´¢¸Ã×ø±êΪÁ˱£Ö¤»ñÈ¡µÄ·½Ïò²»¿ÉÓÃʱ, ²»Ó°ÏìÔÊý¾Ý.
* Á÷³Ì:
* 1. ³õʼ»¯ÆåÅÌ, ÒÔ.ºÅ³õʼ»¯ËùÓÐÔªËØ, ´òÓ¡Ò»´Î¿ÕÆåÅ̺ó, ½«ÆåÅÌ[0, 0]×ø±êÔªËØÉèÖÃΪ'A'.
* 2. ÉèÖÃËæ»úÊýÉú³ÉÖÖ×ÓΪµ±Ç°Ê±¼ä, ÒÔ±£Ö¤Ã¿´ÎÉú³ÉµÄËæ»úÊý²»Í¬.
* 2. Ñ»·´¦Àí×Öĸ
* 3. »ñÈ¡Ëæ»ú·½Ïò, ²¢¸ù¾Ý·½ÏòÈ¡µÃÒƶ¯ºóµÄ×ø±ê, ±£´æµ½ÁÙʱ±äÁ¿rowºÍcolÖÐ.
* 4. ÅжÏеÄ×ø±êÊÇ·ñÓÐЧ
* 5. Èç¹ûÐÂ×ø±ê²»¿ÉÓÃ, µ½µÚ3²½ÖØлñÈ¡·½Ïò.
* 6. Èç¹ûÐÂ×ø±êÓÐЧ:
* 6.1. ÉèÖÃÆåÅ̶ÔӦλÖõÄ×Öĸ
* 6.2. ½«ÁÙʱ×ø±êÐÅϢת´æµ½ÕæÕýµÄµ±Ç°×ø±êi, jÖÐ.
* 6.3. »ñÈ¡ÏÂÒ»¸ö×Öĸ
* 6.4. µ½µÚ2²½ÖØпªÊ¼´¦ÀíÏÂÒ»¸ö×Öĸ.
* 7. ´òÓ¡×îºóÉú³ÉµÄÆåÅÌ.
*
*/
int main() {
char board[ROWS][COLS];
int i, j, direction;
srand( (unsigned) time(NULL));
for(i = 0; i < ROWS; i ++) {
for(j = 0; j < COLS; j ++) {
board[i][j] = '.';
}
}
for(i = 0; i < ROWS; i ++) {
for(j = 0; j < COLS; j ++) {
printf("%c ", board[i][j]);
}
printf("\n");
}
board[0][0] = 'A';
printf("\n");
char ch;
i = 0; j = 0;
int row = 0, col = 0;
for(ch = 'B'; ch <= 'Z';) {
direction = rand() % 8;
switch(directio
Ïà¹ØÎĵµ£º
rows="2" cols="20" id="ctl00_ctl00_cphContent_cphDoc_EntryEditor1_richTextEditor" class="mceEditor" style="height:450px;width:100%;">
Õ»ÊÇÊý¾Ý½á¹¹ÖÐ×î»ù´¡Ò²ÊÇ×î¾µäµÄÊý¾Ý½á¹¹£¬ÎÞÂÛÔÚÓ¦Óû¹ÊDzÙ×÷ϵͳÖоù¿ÉÒÔ¿´µ½ÆäÉíÓ°¡£Õ»ÊÇÒ»ÖÖÌØÊâµÄ
ÏßÐÔ±í£¬¼´ÏÞÖÆÔÚ±íµÄÒ»¶Ë½øÐвåÈ롢ɾ³ýÔËË㡣ͨ³£²åÈ롢ɾ³ýµÄÒ»¶Ë³ ......
11¡¢ÏÂÃæµÄ´úÂëÊä³öÊÇʲô£¬ÎªÊ²Ã´£¿
Void foo(void)
{
unsigned int a = 6;
int b = -20;
(a+b > 6) £¿puts("> 6") : puts("<= 6");
}
²»¹ÜÈçºÎ£¬ÕâÎÞ·ûºÅÕûÐÍÎÊÌâµÄ´ð°¸ÊÇÊä³öÊÇ“>6”¡£ÔÒòÊǵ±±í´ïʽÖдæÔÚÓзûºÅÀàÐͺÍÎÞ·ûºÅÀàÐÍʱËùÓеIJÙ×÷Êý¶¼×Ô¶¯×ª»»ÎªÎÞ·ûºÅÀàÐÍ¡£Òò´Ë-20±ä³ÉÁËÒ»¸ ......
http://blog.csdn.net/noah1987/archive/2008/10/21/3118934.aspx
±¾³ÌÐò¿ÉÒÔ¶ÁÈ¡.wavÎļþ£¬È»ºó½øÐв¥·Å¡£
ʹÓÃÇ°£¬ÇëÈ·ÈÏÄúÊÇ·ñ°²×°ÒôƵÇý¶¯¡£
È·ÈÏ·½·¨£ºcat /etc/sndstat£¬Èç¹ûÏÔʾÎÞ´ËÉ豸£¬ÔòûÓа²×°Çý¶¯¡£
°²×°Çý¶¯ºÜ¼òµ¥£¬µ½oss.comÉÏÏÂÔØÒôƵÇý¶¯£¬È»ºó°´ÕÕÍøÉϵĽ̳̽øÐоͿÉÒÔÁË¡£
Ô´´úÂëÈçÏ£º
#include ......
¡¡¡¡1£¬mallocÓëfreeÊÇC++/CÓïÑԵıê×¼¿âº¯Êý£¬new/deleteÊÇC++µÄÔËËã·û¡£ËüÃǶ¼¿ÉÓÃÓÚÉêÇ붯̬ÄÚ´æºÍÊÍ·ÅÄÚ´æ¡£
¡¡¡¡2£¬¶ÔÓÚ·ÇÄÚ²¿Êý¾ÝÀàÐ͵ĶÔÏó¶øÑÔ£¬¹âÓÃmaloc/freeÎÞ·¨Âú×㶯̬¶ÔÏóµÄÒªÇ󡣶ÔÏóÔÚ´´½¨µÄͬʱҪ×Ô¶¯Ö´Ðй¹Ô캯Êý£¬¶ÔÏóÔÚÏûÍö֮ǰҪ×Ô¶¯Ö´ÐÐÎö¹¹º¯Êý¡£ÓÉÓÚmalloc/freeÊǿ⺯Êý¶ø²»ÊÇÔËËã·û£¬²»ÔÚ±àÒëÆ ......