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

cºÍc++ÏÂÓÃջʵÏÖÊýµÄ½øÖÆת»»

1. CµÄʵÏÖ
//stack.h
#ifndef STACK_H
#define STACK_H
#define STACK_CAPACITY 20//maximum size of stack
typedef int stackEle;
typedef struct
{
stackEle myArray[ STACK_CAPACITY ];
int myTop;
}stack;
//construct(initialize) an empty stack
stack *stack_init(void);
//return 1 if stack is empty and 0 otherwise
int empty(stack *);
//retrieve top element of the stack
stackEle top(stack* );
//add an element at the top of the stack
void push(stack*,stackEle);
//remove the top element of the stack
void pop(stack* );
#endif
//stack.c
#include <stdio.h>
#include "stack.h"
#include <assert.h>
#include <stdlib.h>
//construct (initialize) an empty stack
stack* stack_init(void)
{
stack* s = (stack*)malloc(sizeof(stack));
assert(s);
s->myTop = -1;//stack is empty
return s;
}
//return 1 if stack is empty and 0 otherwise
int empty(stack *s)
{
assert(s);
if(0 > s->myTop)
return 1;
else
return 0;

}
//retrieve top element of the stack
stackEle top(stack* s)
{
assert(s);
if(0 > s->myTop)
{
printf("Error:stack is empty--no value can be reported\n");
exit(1);
}
return s->myArray[s->myTop];
}
//add an element at the top of the stack
void push(stack* s,stackEle val)
{
assert(s);
s->myTop++;
if(STACK_CAPACITY < s->myTop)//check if overflow
{
printf("Error:stack is full--can't add new value\n");
exit(1);
}
s->myArray[s->myTop] = val;
}
//remove the top element of the stack
void pop(stack* s)
{
assert(s);
if(0 > s->myTop)//check if underflow
{
printf("Error:stack is empty--can't remove a value\n");
exit(1);
}
printf("%d ",s->myArray[s->myTop--]);
}
//do base-10 to base-2 transformation by array-based stack
int main()
{
stack *mystack = stack_init();
int a = 255,b,base = 2;
do
{
b = a % base;
push(mystack,b);
a = a / base;
} while(a != 0);

while(!empty(mystack))
pop(mystack);


Ïà¹ØÎĵµ£º

C# C/SģʽÏÂʵÏÖÈí¼þ×Ô¶¯ÔÚÏßÉý¼¶

1 Ç°ÑÔ 
¡¡³¤ÆÚÒÔÀ´£¬¹ã´ó³ÌÐòԱΪµ½µ×ÊÇʹÓÃClient/Server£¬»¹ÊÇʹÓÃBrowser/Server½á¹¹ÕùÂÛ²»ÐÝ£¬ÔÚÕâЩÕùÂÛµ±ÖÐ,C/S½á¹¹µÄ³ÌÐò¿Éά»¤ÐԲ²¼ÖÃÀ§ÄÑ£¬Éý¼¶²»·½±ã£¬Î¬»¤³É±¾¸ß¾ÍÊÇÒ»¸öÏ൱ÖØÒªµÄÒòËØ¡£ÓкܶàÆóÒµÓû§¾ÍÊÇÒòΪÕâ¸öÔ­Òò¶ø·ÅÆúʹÓÃC/S¡£È»¶øµ±Ò»¸öÓ¦ÓñØÐëҪʹÓÃC/S½á¹¹²ÅÄܺܺõÄʵÏÖÆ书ÄܵÄʱ ......

´ò¿ªIE˵ÎÞ·¨ÕÒµ½½Å±¾Îļþ¡¾C£ºProgeam Files\*¡¿

½ñÌì·¢ÏÖµçÄÔ³öÏÖĪÃûÆæÃîµÄÎÊÌ⣬ÈÎÎñÀ¸µÄͼ±ê¶¼ÎÞ·¨Ê¹ÓÃÁË¡£¶øÇÒ×¢²á±íÒ²ÎÞ·¨Ê¹Óá£
´¦Àí·½·¨£º
Ò»¡¢ÏȽâËø×¢²á±í¡£´Ë²½Öèºó¿ÉÒÔÕý³£·ÃÎÊÐÞ¸Ä×¢²á±í¡£
http://zhidao.baidu.com/question/8109053.html?fr=ala0
×¢²á±í±»¹ÜÀíԱͣÓã¬
1¡¢Ð½¨Ò»¸öÎı¾Îļþ£¬ÔÚÆäÖÐÊäÈëÒÔÏÂÄÚÈÝ¡£
[HKEY_CURRENT_USER/Software/Micro ......

C/C++µÄ64λÕûÐÍ ²»Í¬±àÒëÆ÷¼äµÄ±È½Ï


//ΪÁ˺ÍDSP¼æÈÝ£¬TSint64ºÍTUint64ÉèÖóÉTSint40ºÍTUint40Ò»ÑùµÄÊý  
//½á¹ûVCÖл¹ÊÇÈÏΪÊÇ32λµÄ£¬ÏÔÈ»²»ºÏÊÊ  
//typedef signed long int     TSint64;  
//typedef unsigned long int   TUint64; &nb ......

ѧÉú¹ÜÀíϵͳ(c/cpp)

#include
using namespace std;
typedef struct lnode
{
    long sno;
    char name[20];
    struct lnode *next;
}LNode, *LinkList;
LinkList InitList()
{
    LinkList head;
    head = new LNode;
 &nb ......

C/C++µ¥Ôª²âÊÔÀíÂÛ¾«Òª£¨Ê®¶þ£¬Í꣩

4.2 ¶à½Ç¶È±£Ö¤²âÊÔЧ¹û
    ¶ÔÓÚ´úÂëÖÊÁ¿ÒªÇóºÜ¸ßµÄÏîÄ¿À´Ëµ£¬½öÓа׺и²¸ÇÊÇÔ¶Ô¶²»¹»µÄ¡£°×ºÐ¸²¸Ç²»ÄÜ·¢ÏÖ´úÂëȱʧ£¬°×ºÐ¸²¸Ç»ùÓÚÏÖÓдúÂ룬Èç¹û´úÂë²»´æÔÚ£¬µ±È»²»ÄÜ·¢ÏÖ¡£ÎªÁ˼ì²â´úÂëȱʧ£¬ÐèÒªÈ˹¤¶Ô²âÊÔÊý¾Ý½øÐмì²é¡£°×ºÐ¸²¸ÇÒ²²»ÄÜ·¢ÏÖÓÃÀýδ·´Ó³¹¦ÄÜ¡£Èç¹ûÉè¼ÆÓÃÀýʱ£¬²âÊÔÔ±²»Á˽â´úÂëµÄ¹¦ÄÜ£¬Í ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ