C/C++Öеĺê
ºê¶¨ÒåÁËÒ»¸ö´ú±íÌض¨ÄÚÈݵıêʶ·û¡£Ô¤´¦Àí¹ý³Ì»á°ÑÔ´´úÂëÖгöÏֵĺê±êʶ·ûÌæ»»³Éºê¶¨ÒåʱµÄÖµ¡£ºê
×î³£¼ûµÄÓ÷¨ÊǶ¨Òå´ú±íij¸öÖµµÄÈ«¾Ö·ûºÅ¡£ºêµÄµÚ¶þÖÖÓ÷¨ÊǶ¨Òå´ø²ÎÊýµÄºê£¬ÕâÑùµÄºê¿ÉÒÔÏóº¯ÊýÒ»Ñù
±»µ÷Ó㬵«ËüÊÇÔÚµ÷ÓÃÓï¾ä´¦Õ¹¿ªºê£¬²¢Óõ÷ÓÃʱµÄʵ¼Ê²ÎÊýÀ´´úÌ涨ÒåÖеÄÐÎʽ²ÎÊý¡£
1.#defineÖ¸Áî
#defineÔ¤´¦ÀíÖ¸ÁîÊÇÓÃÀ´¶¨ÒåºêµÄ¡£¸ÃÖ¸Áî×î¼òµ¥µÄ¸ñʽÊÇ£ºÊ×ÏÈÉñÃ÷Ò»¸ö±êʶ·û£¬È»ºó¸ø³öÕâ¸ö±ê
ʶ·û´ú±íµÄ´úÂë¡£ÔÚºóÃæµÄÔ´´úÂëÖУ¬¾ÍÓÃÕâЩ´úÂëÀ´Ìæ´ú¸Ã±êʶ·û¡£ÕâÖÖºê°Ñ³ÌÐòÖÐÒªÓõ½µÄһЩȫ¾ÖÖµ
ÌáÈ¡³öÀ´£¬¸³¸øһЩ¼ÇÒä±êʶ·û¡£
#define MAX_NUM 10
int array[MAX_NUM];
for(i = 0; i < MAX_NUM; i++) /*……*/
ÔÚÕâ¸öÀý×ÓÖУ¬¶ÔÓÚÔĶÁ¸Ã³ÌÐòµÄÈËÀ´Ëµ£¬·ûºÅMAX_NUM¾ÍÓÐÌض¨µÄº¬Ò壬Ëü´ú±íµÄÖµ¸ø³öÁËÊý
×éËùÄÜÈÝÄɵÄ×î´óÔªËØÊýÄ¿¡£³ÌÐòÖпÉÒÔ¶à´ÎʹÓÃÕâ¸öÖµ¡£×÷ΪһÖÖÔ¼¶¨£¬Ï°¹ßÉÏ×ÜÊÇÈ«²¿Óôóд×ÖĸÀ´¶¨
Òåºê£¬ÕâÑùÒ×ÓڰѳÌÐòºìµÄºê±êʶ·ûºÍÒ»°ã±äÁ¿±êʶ·ûÇø±ð¿ªÀ´¡£Èç¹ûÏëÒª¸Ä±äÊý×éµÄ´óС£¬Ö»ÐèÒª¸ü¸Äºê
¶¨Òå²¢ÖØбàÒë³ÌÐò¼´¿É¡£
ºê±íʾµÄÖµ¿ÉÒÔÊÇÒ»¸ö³£Á¿±í´ïʽ£¬ÆäÖÐÔÊÐí°üÀ¨Ç°ÃæÒѾ¶¨ÒåµÄºê±êʶ·û¡£ÀýÈ磺
#define ONE 1
#define TWO 2
#define THREE (ONE+TWO)
×¢ÒâÉÏÃæµÄºê¶¨ÒåʹÓÃÁËÀ¨ºÅ¡£¾¡¹ÜËüÃDz¢²»ÊDZØÐëµÄ¡£µ«³öÓÚ½÷É÷¿¼ÂÇ£¬»¹ÊÇÓ¦¸Ã¼ÓÉÏÀ¨ºÅµÄ¡£Àý
È磺
six = THREE * TWO;
Ô¤´¦Àí¹ý³Ì°ÑÉÏÃæµÄÒ»ÐдúÂëת»»³É£º
six = (ONE + TWO) * TWO;
Èç¹ûûÓÐÄǸöÀ¨ºÅ£¬¾Íת»»³Ésix = ONE + TWO * TWO;ÁË¡£
ºê»¹¿ÉÒÔ´ú±íÒ»¸ö×Ö·û´®³£Á¿£¬ÀýÈ磺
#define VERSION "Version 1.0 Copyright(c) 2003"
2.´ø²ÎÊýµÄ#defineÖ¸Áî
´ø²ÎÊýµÄºêºÍº¯Êýµ÷Óÿ´ÆðÀ´ÓÐЩÏàËÆ¡£¿´Ò»¸öÀý×Ó£º
#define Cube(x) (x) * (x) * (x)
¿ÉÒÔʱÈκÎÊý×Ö±í´ïʽÉõÖÁº¯Êýµ÷ÓÃÀ´´úÌæ²ÎÊýx¡£ÕâÀïÔÙ´ÎÌáÐÑ´ó¼Ò×¢ÒâÀ¨ºÅµÄʹÓ᣺êÕ¹¿ªºóÍêÈ«
°üº¬ÔÚÒ»¶ÔÀ¨ºÅÖУ¬¶øÇÒ²ÎÊýÒ²°üº¬ÔÚÀ¨ºÅÖУ¬ÕâÑù¾Í±£Ö¤Á˺êºÍ²ÎÊýµÄÍêÕûÐÔ¡£¿´Ò»¸öÓ÷¨£º
int num = 8 + 2;
volume = Cube(num);
Õ¹¿ªºóΪ(8 + 2) * (8 + 2) * (8 + 2);
Èç¹ûûÓÐÄÇЩÀ¨ºÅ¾Í±äΪ8 + 2 * 8 + 2 * 8 + 2ÁË¡£
ÏÂÃæµÄÓ÷¨ÊDz»°²È«µÄ£º
volume=Cube(num++);
Èç¹ûCubeÊÇÒ»¸öº¯Êý£¬ÉÏÃæµÄд·¨ÊÇ¿ÉÒÔÀí½âµÄ¡£µ«ÊÇ£¬ÒòΪCubeÊÇÒ»¸öºê£¬ËùÒÔ»á²úÉú¸±×÷Óá£
ÕâÀïµÄ²ÁÊé²»ÊǼòµ¥µÄ±í´ïʽ£¬ËüÃǽ«²úÉúÒâÏë²»µ½µÄ½á¹û¡£ËüÃÇÕ¹¿ªºóÊÇÕâÑùµÄ£º
volume = (num++) * (num++) * (
Ïà¹ØÎĵµ£º
/*
×¢Òâ²»¶ÏÓÒÒÆÅжÏ×îµÍλÊÇ1ÓжàÉÙ¸öµÄËã·¨ÊÇ´íÎóµÄ£¬
ÒòΪ¸ù¾ÝGNU C/C++µÄʵÏÖÀ´¿´£¬¸ºÊýÊÇ´ø·ûºÅÌî³ä½øÐÐÓÒÒƵģ¬ËùÒÔÈç¹ûÊǸºÊý£¬¸ÃËã·¨»áËÀÑ»·¡£
±äͨ°ì·¨£ºJava¿ÉÒÔÓÃ>>>Âß¼ÓÒÒÆλ²Ù×÷·û£¬C/C++¿ÉÒÔÇ¿ÖÆת»»³ÉÎÞ·ûºÅÕûÊýÔÙ´¦Àí
ÏÂÃæµÄ³ÌÐòÊÇÕý½â¡£ÆäÖÐnum &= (num - 1) »áÏû³ýnumµÄ×îСλÖõÄ"1" ......
/*
ÕâÊǸö³£¼ûµÄÃæÊÔÌâŶ£¬×ÜÖ®ÎÒÃæÊÔµÄʱºòÓöµ½¹ý£¬ µ±Ê±Ã»ÓдðÉÏÀ´
»ØÈ¥ºóÏë³öÀ´ÏÂÃæµÄ·½·¨Ò»£¬¸Ã·¨»¹Óиö¸½¼ÓÓŵ㣬¿ÉÒÔÅжϳöÁ´±íÔÚÄĸöµØ·½Ðγɻ·µÄ£¨¼´Èç¹ûÏë²ð¿ªÕâ¸ö»·£¬´ÓÄĸöµØ·½¶Ï¿ª£©¡£
ºóÀ´ÖªµÀ»¹Óиö¾µäËã·¨£¬¼´Ê¹ÓÃÁ½¸öÖ¸Õ룬һ¿ìÒ»ÂýÏòÇ°ÊÔ̽£¬Èç¹û×îÖÕÖغÏÔòÁ´±íÓл·£¬¹ûÈ»ÓÅÃÀµÄËã·¨¡£
*/
#inc ......
#include "Stdio.h"
#include "Conio.h"
#include
#define size 81
#define lim 5
#define tstr "ABCDEFGH"
void display(char **p,int i);
void display2(char *p[],int i);
void display3(char (*p)[40],int i);
void testint();
int main(void)
{
testint();
getch();
return 0;
}
test1() ......
ת×Ô£ºhttp://hi.baidu.com/ssrt_hanbing/blog/item/62e3b934598eeb82a71e1238.html
ͨ¹ý¸ßµÍλת»»¡£
package com.commnt;
import java.net.*;
import java.io.*;
public class Client {
public String send(String address, int port, String str) {
OutputStream os = null;
DataInpu ......
LinuxÄں˴úÂë·ÖÎö slab.c by Áõ¿º liukang@bjut.edu.cn
slab.cÀ´×ÔlinuxÄÚºË2.4.22°æ£¬±¾Îļþ°´ÕÕGNUÐÒé·¢²¼¡£
Ò»¡¢×¼±¸ÖªÊ¶£º
slabµÄ¸ÅÄ
Ìá³öµÄÔÒò£ºÓÉÓÚ²Ù×÷ϵͳÔÚÔËÐÐÖл᲻¶Ï²úÉú¡¢Ê¹Óá¢ÊÍ·Å´óÁ¿Öظ´µÄ¶ÔÏó£¬
ËùÒÔ¶ÔÕâÑùµÄÖظ´¶ÔÏóµÄÉú³É½øÐиĽø¿ÉÒÔ´ó´óÌá¸ßЧÂÊ
×îÔçÓÉsunµÄ¹¤³ÌʦÌá³ö(1994Äê)²¢Ê×ÏÈÔ ......