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

±í´ïʽÇóÖµ Êý¾Ý½á¹¹ C/C++ Õ»µÄÓ¦ÓÃ

ÓÃÊéÉϵĴúÂëÆ´´ÕµÄ£¬»¹ÊǺÜÓгɾ͸еĹþ
Ö§³ÖµÄÔËËã·ûºÅÓÐ"+","-","*","/","(",")","#"¡£
Ö§³Ö20λÒÔÄÚÎÞ·ûºÅÕûÊý£¬µ±È»¿ÉÒÔºÜÈÝÒ׵ĸijÉÓзûºÅ»òÕßÊÇʵÐÍÊý
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define OPSETSIZE 7
//º¯Êý½á¹û״̬´úÂë
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
//StatusÊǺ¯ÊýµÄÀàÐÍ£¬ÆäÖµÊǺ¯Êý½á¹û״̬´úÂë
typedef int Status;
#define STACK_INIT_SIZE 1000 //´æ´¢¿Õ¼ä³õʼ·ÖÅäÁ¿
typedef struct{
char *base;
char *top;
int stacksize;
}StackChar;
typedef struct{
float *base;
float *top;
int stacksize;
}StackFloat;
unsigned char Prior[7][7] = { // ±í3.1 Ëã·û¼äµÄÓÅÏȹØϵ
'>','>','<','<','<','>','>',
'>','>','<','<','<','>','>',
'>','>','>','>','<','>','>',
'>','>','>','>','<','>','>',
'<','<','<','<','<','=',' ',
'>','>','>','>',' ','>','>',
'<','<','<','<','<',' ','='
};
float Operate(float a, unsigned char theta, float b);
char OPSET[OPSETSIZE]={'+' , '-' , '*' , '/' ,'(' , ')' , '#'};
Status In(char Test,char* TestOp);
char precede(char Aop, char Bop);
int atof(char* snum){
int l=strlen(snum),i=1,sum=snum[l-1]-'0';
l--;
while(l--){
i*=10;
sum+=(snum[l]-'0')*i;
}
return sum;
}


void InitStackChar(StackChar &S){
//¹¹ÔìÒ»¸ö¿ÕÕ»S
S.base=(char*)malloc(STACK_INIT_SIZE * sizeof(char));
if(!S.base) exit(OVERFLOW);
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
}
void InitStackFloat(StackFloat &S){
//¹¹ÔìÒ»¸ö¿ÕÕ»S
S.base=(float*)malloc(STACK_INIT_SIZE * sizeof(float));
if(!S.base) exit(OVERFLOW);
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
}
char GetTopChar(StackChar S){
//·µ»ØSµÄÕ»¶¥ÔªËØ
return


Ïà¹ØÎĵµ£º

extern "C"

extern "C"
¡¡¡¡extern "C" °üº¬Ë«Öغ¬Ò壬´Ó×ÖÃæÉϼ´¿ÉµÃµ½£ºÊ×ÏÈ£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä´Î£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£ÈÃÎÒÃÇÀ´Ïêϸ½â¶ÁÕâÁ½Öغ¬Òå¡£
¡¡¡¡£¨1£© ±»extern "C"ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵ģ»
¡¡¡¡externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö£ ......

¡¾C¡¿ÒÆλ²Ù×÷ ´¦Àí³Ë·¨

½ñÌìÔÚdoubanÉÏÃæ¿´µ½ÁËÒ»¸öÌû×Ó£¬ÀïÃæ¹ØÓڳ˷¨ÎÊÌâ´ó¼ÒÌÖÂÛÁËÒ»ÏÂ
http://www.douban.com/group/topic/8384097/
¿´µ½ÒÆλ×ö³Ë·¨Ò²²»ÊǵÚÒ»´ÎÁË£¬µ«ÊǺܲïÒìÕæµÄ»áÔÚÓã¬×Ô¼ºË®Æ½»¹¾Í²îÁËÄÇôһµãµã£¬ÎÞ¿É·ñÈÏ£¬ÎÒÃÇ´¦ÀíÆ÷µÄALU×öÒÆλÊÇÏ൱¸ßЧµÄ¡£
ÕâÀï¼Ç¼һÏÂÀïÃæµÄÒ»¸öÒÆλ³Ë·¨Àý×Ó¡£
#include <stdio.h>
# ......

C/C++»ñÈ¡µ±Ç°ÏµÍ³Ê±¼ä(תÔØ)


// ·½°¸— Óŵ㣺½öʹÓÃC ±ê×¼¿â£»È±µã£ºÖ»Äܾ«È·µ½Ã뼶
#include <time.h>
#include <stdio.h>
int main( void )
{
    time_t t = time(0);
    char tmp[64];
    strftime( tmp, sizeof(tmp), "%Y/%m/%d %X %A ±¾ÄêµÚ%jÌì %z",localtim ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ