Ò»¸öc/c++º¯Êýµ÷ÓÃÕ»µÄʵÏÖ
º¯Êýµ÷ÓÃÕ»µÄʵÏÖ¡£¿ÉÓÃÓÚʵÏÖ¼òµ¥µÄ½Å±¾½âÊÍÆ÷¡£
ÉùÃ÷:
#pragma once
const int BUFFERSIZE = 1024;
const int growfactor = 2;
// this stack is used as call stack.
class TStack{
private:
size_t size; // the stack length
size_t pos; // the stack top position
char *buffer; // the buffer
private:
void push(void* D, size_t bytecount); // the implementation of push
void* pop(size_t bytecount); // the implementation of pop
public:
TStack(size_t _size = BUFFERSIZE, size_t _pos = 0); // initialize
TStack(const TStack& o); // copy
TStack& operator=(const TStack& o); // assignment
void pushInt(int i) { push(&i, sizeof(int)); } // push an int
void pushLong(long l) { push(&l, sizeof(long)); } // push a long
void pushfloat(double f) { push(&f, sizeof(f));} // push a double
void pushPointer(void* p){ push(p, sizeof(p)); }
// int
int popInt() { return *(int *)pop(sizeof(int));} // pop an int
long popLong() { return *(long *)pop(sizeof(long)); } // pop an int
double* popfloat() { return (double*)pop(sizeof(double)); } // pop a double
void* popPointer() { return pop(sizeof(void*)) ; }
void clear() { pos = 0; }
};
ʵÏÖ£º
#include "stdafx.h"
#include "TStack.h"
#include "new.h"
void TStack::push( void* D, size_t bytecount )
{
// if memory is not enough
// if run under multithread envionment,
// a lock or critical section should be added
if (pos + bytecount > size)
{
size_t oldsize = size;
size *= growfactor;
char *newbuffer = new char[size];
memcpy(newbuffer, buffer, oldsize);
delete buffer;
buffer = newbuffer;
}
memcpy(buffer+pos, D, bytecount);
pos += bytecount;
}
void* TStack::pop( size_t bytecount )
{
// need synchronization f
Ïà¹ØÎĵµ£º
ΪÁËʵÏÖÁ½¸öÊý×Ö½øÐн»»»£¬ÎÒÃÇͨ³£¿ÉÒÔÀûÓÃλÔËËãÀ´ÊµÏÖ
C++³ÌÐò swap(int a ,int b){a^=b^=a^=b;}
JAVA³ÌÐò swap(int a, int b){ a^=b;b^=a;a^=b; }»òÕß{ b^=(a^=b) ; a^=b;}
Èç¹ûJAVAÓÃC++µÄʵÏÖ·½Ê½Ôò»áµÃµ½ bµÃµ½ÁËaµÄÖµ£¬µ«ÊÇaÏÖÔÚµÄֵȴ² ......
#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field;
......
µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØϵÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëÑ°ÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓ⻶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ²¿ÊðÔÚÐí¶à¹Ø¼ ......
Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í
DelphiÊý¾ÝÀàÐÍC/C++
ShorInt
8λÓзûºÅÕûÊý
char
Byte
8λÎÞ·ûºÅÕûÊý
BYTE,unsigned short
SmallInt
16λÓзûºÅÕûÊý
short
Word
16λÎÞ·ûºÅÕûÊý
unsigned short
Integer,LongInt
32λÓзûºÅÕûÊý
int,long
Cardinal,LongWord/DWORD
32λÎÞ·ûºÅÕûÊý
unsigned long
Int6 ......
ÒýÑÔ
¡¡¡¡Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß» ......