¶ÑÕ»µÄC´úÂëʵÏÖ
2009-09-13 16:42:43
½ñÌìʵÏÖ¶ÑÕ»½á¹¹²¿·ÖµÄ´úÂ룬²¢ÓÃÒ»¼òµ¥³ÌÐò²âÊԳɹ¦¡£
stack.h:
#ifndef _STACK_H_
#define _STACK_H_
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#define STACK_INIT_SIZE 5
#define STACKINCREMENT 5
typedef int SElemType; //the elements type
typedef enum {
TRUE=0,
FALSE=-1
} Status;
typedef struct {
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
Status InitStack(SqStack *S);
Status DestoryStack(SqStack *S);
Status ClearStack(SqStack *S);
Status StackEmpty(SqStack S);
int LengthStack(SqStack S);
Status GetTop(SqStack S,SElemType *e);
Status Push(SqStack *S,SElemType e);
Status Pop(SqStack *S,SElemType *e);
Status StackTraverse(SqStack S);
#endif
stack.c
#include "Stack.h"
Status InitStack (SqStack *S)
{
if((S->base=(SElemType *)malloc(STACK_INIT_SIZE * sizeof(SElemType)))==(SElemType*)NULL){
printf("init stack malloc error !\n");
return FALSE;
}
S->top=S->base;
S->stacksize=STACK_INIT_SIZE;
return TRUE;
}
Status DestoryStack(SqStack* S)
{
free(S->base);
S->base=S->top=(SElemType*)NULL;
S->stacksize=0;
return TRUE;
}
Status ClearStack(SqStack * S)
{
if(S->top <= S->base){
printf("not stack or empty stack !\n");
return FALSE;
}
S->top = S->base;
return FALSE;
}
Status StackEmpty(SqStack S)
{
if(S.top == S.base){
printf("empty stack checked!\n");
return TRUE;
}
else return FALSE;
}
int LengthStack(SqStack S)
{
return S.top-S.base;
}
Status GetTop(SqStack S, SElemType * e)
{
if(S.top==S.base){
printf("the stack is already empty !\n");
return FALSE;
}
*e=*(S.top-1);
return TRUE;
}
Status StackRealloc (SqStack *S, size_t size)
{
size_t offset = 0;
SElemType* temp = (SElemType *)NULL;
if((temp = (SElemType*)malloc(size))==(SElemType*)NULL){
printf("realloc address OX%d\n");
printf("realloc error!
Ïà¹ØÎĵµ£º
BSÓëCSµÄÁªÏµÓëÇø±ð[ת]
5
ÍƼö
javaÊʺϿª·¢bs½á¹¹£¬cs²»ÊÇËüµÄÇ¿Ïî.
C/SÊÇClient/ServerµÄËõд¡£·þÎñÆ÷ͨ³£²ÉÓøßÐÔÄܵÄPC¡¢¹¤×÷Õ¾»òСÐÍ»ú£¬²¢²ÉÓôóÐÍÊý¾Ý¿âϵͳ£¬ÈçOracle¡¢Sybase¡¢Informix»ò SQL Server¡£¿Í»§¶ËÐèÒª°²×°×¨ÓõĿͻ§¶ËÈí¼þ¡£
B/SÊÇBrower/ServerµÄËõд£¬¿Í»§»úÉÏÖ»Òª°²×°Ò»¸öä¯ÀÀÆ÷£¨Browser£© ......
¡¡¡¡ÒýÑÔ
¡¡¡¡Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉ ......
CÖеÄCONST¡¡¡¡
CÖÐCONSTµÄʹÓãº
¡¡¡¡constÊÇÒ»¸öCÓïÑԵĹؼü×Ö£¬ËüÏÞ¶¨Ò»¸ö±äÁ¿²»ÔÊÐí±»¸Ä±ä¡£Ê¹ÓÃconstÔÚÒ»¶¨³Ì¶ÈÉÏ¿ÉÒÔÌá¸ß³ÌÐòµÄ°²È«ÐԺͿɿ¿ÐÔ£¬ÁíÍ⣬ÔÚ¹Û¿´±ðÈË´úÂëµÄʱºò£¬ÇåÎúÀí½âconstËùÆðµÄ×÷Ó㬶ÔÀí½â¶Ô·½µÄ³ÌÐòÒ²ÓÐһЩ°ïÖú¡£
¡¡¡¡ËäÈ»ÕâÌýÆðÀ´ºÜ¼òµ¥£¬µ«Êµ¼ÊÉÏ£¬constµÄʹÓÃÒ²ÊÇcÓïÑÔÖÐÒ»¸ö±È½Ï΢ÃîµÄµØ ......
Java¿çƽ̨µÄÌØÐÔʹJavaÔ½À´Ô½ÊÜ¿ª·¢ÈËÔ±µÄ»¶Ó£¬µ«Ò²ÍùÍù»áÌýµ½²»Éٵı§Ô¹£ºÓÃJava¿ª·¢µÄͼÐÎÓû§´°¿Ú½çÃæÿ´ÎÔÚÆô¶¯µÄʱºò¶¼»áÌø³öÒ»¸ö¿ØÖÆ̨´°¿Ú£¬Õâ¸ö¿ØÖÆ̨´°¿ÚÈñ¾À´·Ç³£°ôµÄ½çÃæʧɫ²»ÉÙ¡£ÔõôÄܹ»ÈÃͨ¹ýJava¿ª·¢µÄGUI³ÌÐò²»µ¯³öJavaµÄ¿ØÖÆ̨´°¿ÚÄØ£¿ÆäʵÏÖÔںܶàÁ÷ÐеĿª·¢»·¾³ÀýÈçJBuilder¡¢Eclipse¶¼ÊÇʹÓô¿Java ......