Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

CºêµÄÓ÷¨

Ç°¼¸Ìì²Î¼Óij¹«Ë¾µÄ±ÊÊÔ£¬ÓÐÒ»µÀÌâÊÇÓô¿CʵÏÖÒ»¸ö·ºÐͺ¯Êý¡£ÓôÃÆÁ˺þÃÓÃC++Ä£°åʵÏÖÁË¡£
ºêÓÐÈçϵÄÌص㣺
1.ÓëconstÏà±È£¬ºêÊÇÔÚÔ¤±àÒëµÄʱºòÍê³ÉµÄ
2.define Ö»×ö¼òµ¥µÄÌæ»»£¬²»×öÀàÐÍ°²È«¼ì²é
3.ʹÓò»µ±»áÒýÆðºÜ¶àÎÊÌâ
ºêµÄÓ÷¨£º
1.¼òµ¥µÄºê¶¨Òå
#define  MAX 1024
2.ºê¶¨Ò幦ÄÜ¿é
#define MAX(a,b) (a)>(b)?(a):(b)      //±È½Ï´óСµÄºê
3¶¨Ò庯ÊýʵÏÖ·ºÐÍ
#define SORT(Type) void Buble_sort(Type a[],int len) { \
bool is_swap=true;\
for(int i=0;i<len&&is_swap;++i)\
{\
is_swap = false;\
for(int j=0;j<len-i;++j)\
{\
if(a[j]>a[j+1])\
{\
Type t;\
t=a[j];\
a[j+1] = a[j];\
a[j]=t;\
is_swap = true;\
}\
}\
}\
}
SORT(int);
SORT(double);
SORT(float);
SORT(unsigned int);
4.¶¨ÒåÀà
  #define   _DECL_class(name,   element   )\  
  class   df_##nm\  
  {\  
  protected:\  
  element         *pData;\  
  int num;\  
  \  
  void   _resize(int   n);\  
  \  
  public:\  
  nm(   ){};\  
  \  
  int   Count()   const   {   return   num;   }\  
  \};  
   
   
  _DECL_class(   cls_example,   int   );  


Ïà¹ØÎĵµ£º

ʲôÊÇÐÅÔë±È S/N ¡¢ÔØÔë±È C/N Óë Eb/N0 £¿

ÐÅÔë±È( S N )ÊÇÖ¸´«ÊäÐźŵÄƽ¾ù¹¦ÂÊÓë¼ÓÐÔÔëÉùµÄƽ¾ù¹¦ÂÊÖ®±È¡£
ÔØÔë±È(C N )Ö¸ÒѾ­µ÷ÖƵÄÐźŵÄƽ¾ù¹¦ÂÊÓë¼ÓÐÔÔëÉùµÄƽ¾ù¹¦ÂÊÖ®±È¡£
ËüÃÇͨ³£¶¼ÒÔ¶ÔÊýµÄ·½Ê½À´¼ÆË㣬µ¥Î»ÎªdB¡£
ÐÅÔë±ÈÓëÔØÔë±ÈÇø±ðÔÚÓÚ£¬ÔØÔë±ÈÖÐÒѵ÷ÐźŵŦÂÊ°üÀ¨ÁË´«ÊäÐźŵŦÂʺ͵÷ÖÆÔز¨µÄ¹¦ÂÊ£¬¶øÐÅÔë±ÈÖнö°üÀ¨´«ÊäÐźŵŦÂÊ£¬Á½ÕßÖ®¼äÏà²îÒ ......

c++/c±à³Ì×¢ÒâÊÂÏî

ÈÝÒ×´íÎóµÄʹÓÃÖ¸Õë:
void GetMemory(char *p, int num)
{
p = (char *)malloc(sizeof(char) * num);
}
void Test(void)
{
char *str = NULL;
GetMemory(str, 100); // str ÈÔȻΪ NULL
strcpy(str, "hello"); // ÔËÐдíÎó
}
벡³öÔÚº¯ÊýGetMemory ÖС£±àÒëÆ÷×ÜÊÇÒ ......

Linux C ±à³Ì ʵÏÖ²ÊÉ«ÎÄ×ÖÊä³ö

¸ñʽ: echo "\033[×Ö±³¾°ÑÕÉ«;×ÖÌåÑÕÉ«m×Ö·û´®\033[0m"
ÀýÈç:
echo "\033[41;36m something here \033[0m"
ÆäÖÐ41µÄλÖôú±íµ×É«, 36µÄλÖÃÊÇ´ú±í×ÖµÄÑÕÉ«
ÄÇЩascii code ÊǶÔÑÕÉ«µ÷ÓõÄʼĩ.
\033[ ; m …… \033[0m
×Ö±³¾°ÑÕÉ«·¶Î§:40----49
40:ºÚ
41:Éîºì
42:ÂÌ
43:»ÆÉ«
44:À¶É«
45:×ÏÉ«
4 ......

c ÓïÑÔ³£Óú궨Òå Ä£°å

 
³£Óú궨Òå
1¡¢·ÀÖ¹Ò»¸öÍ·Îļþ±»Öظ´°üº¬
#ifndef COMDEF_H
#define COMDEF_H
//Í·ÎļþÄÚÈÝ
#endif
2¡¢ÖØж¨ÒåһЩÀàÐÍ£¬·ÀÖ¹ÓÉÓÚ¸÷ÖÖƽ̨ºÍ±àÒëÆ÷µÄ²»Í¬£¬¶ø²úÉúµÄÀàÐÍ×Ö½ÚÊý²îÒ죬·½±ãÒÆÖ²¡£
typedef  unsigned char      boolean;     /* Boolean v ......

¹ØÓÚCµÄÓÐȤÎÊÌâ

//ÒÔϳÌÐòÊÇʵÏÖСдת´óд³ÌÐò
#include<stdio.h>
void to_upper(char *str)
{
    for(;*str !='\0';str++)
    {
        if(unsigned(*str-'a')<='z'-'a')
            *str-='a'-'A';//Ð ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ