C/C++ Ö®ÂÃ
ûÏëµ½ ûÏëµ½ ÍòÍòûÏëµ½
¶ÔC++°ËÇÏֻͨÁË7ÇϵÄÎÒ£¬¾¹È»Òª¿ªÊ¼¸ãc++Á˵Ä˵£¬ÕæÊǺò»´Ì¼¤¡£
²»¸ÒÏàÐÅ£¬²»¸ÒÏàÐÅ¡£
ÀàÐÍÊÇʲôÍæÒ⣿ÀàÔõôд£¿×Ö·û´®Ôõô´¦Àí£¿ÔõôÊÍ·ÅÄڴ棿
ż²»Öª£¬²»Öª£¬ÕæµÄ²»Öª¡£¡£¡£¡£
°¥ Í궼ÍêÁË¡£
°¦ ²»¹ÜÔõô˵¶¼ÒªÈ¥Ñ§µÄ¡£¡£¡£Ò»µãÕÞ¶¼Ã»ÓÐ
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
namespace Algorythms
{
int insert_sort(int Array[],int Length)
{
for( int i = 0 ; i < Length ; i ++ )
{
int p = i;
for( int j = i ; j < Length ; j ++ )
{
if(Array[j] < Array[p])
{
p = j;
}
}
if(p != i) //Swap
{
int tmp = Array[p];
Array[p] = Array[i];
Array[i] = tmp;
}
}
return 0;
}
int Merge(int Array[],int p,int q,int r)
{
int a = q - p + 1;
int b = r - q;
int *L = new int[a + 1];
int *R = new int[b + 1];
int i = 0;
int j = 0;
for(i = 0; i < a; i ++)
{
L[i] = Array[p+i];
}
for(i = 0; i < b; i ++)
{
R[i] = Array[q+i+1];
}
L[a] = 0x7FFFFFF;
R[b] = 0x7FFFFFF;
i = 0;
j = 0;
for(int k = p; k <= r ; k ++)
{
if(L[i] <= R[j])
{
Array[k] = L[i];
i ++;
}
else
{
Array[k] = R[j];
j ++;
}
}
return 0;
}
int Merge_Sort(int Array[],int p,int r)
{
if(p < r)
{
int q = (p + r) / 2;
Merge_Sort(Array,p,q);
Merge_Sort(Array,q+1,r);
Merge(Array,p,q,r);
}
return 0;
}
int Reserver(int Array[],int Length)
{
int * e = Array + Length -1;
int * f = Array;
while(f < e)
{
int tmp = *f;
*f = *e;
*e = tmp;
f ++;
e --;
}
return 0;
}
int Exchange(int *a,int *b)
{
int tmp = *a;
*a = *b;
*b = tmp;
return 0;
}
int Bubble_Sort(int Array[],int Length)
{
for(int i = 0; i < Length - 1; i ++)
{
for(int j = Length - 1; j >= i + 1; j --)
{
if(Array[j] < Array[j - 1])
{
Ex
Ïà¹ØÎĵµ£º
3.3 ¸ßЧÂÊ¿ª·¢
ÕâÒ»½Ú½éÉÜÀûÓõ¥Ôª²âÊÔʵÏÖ¸ßЧÂÊ¿ª·¢¡£µ¥Ôª²âÊÔ¿ÉÒÔÔÚ¼¸¸ö·½ÃæÌá¸ß¿ª·¢Ð§ÂÊ£º²âÊÔÇý¶¯¿ª·¢¡¢¿ÉÊÓ±à³Ì¡¢¿ìËÙÅÅ´í¡¢ºÍÌá¸ßµ÷ÊÔЧÂÊ¡£
²âÊÔÇý¶¯¿ª·¢
Ö¸Ïȱàд²âÊÔ´úÂ룬ȻºóÔÙ±àд²úÆ·´úÂëʹ²âÊÔͨ¹ý£¬ÓкܶàÏà¹ØÎÄÕºÍÊé¼®½éÉÜÕâ·½Ãæ֪ʶ£¬ÏÞÓÚ±à·ù£¬ÕâÀï¾Í²»½²ÁË ......
ÐÞ¸Ämakefile£¬ÔÚLIBSÀïÃæ¼ÓÉÏ-lmemcached£¬±ÈÈçÔÀ´ gcc test.c£¬ÏÖÔÚ gcc test.c -lmemcached¡£Õâ¸ö¿â¾ÍÊÇlibmemcachedÌṩµÄ¡£
È»ºóÌí¼Ó#include<libmemcached/memcached.h>£¬Õâ¸öÎļþÒ²ÊÇlibmemcachedÌṩµÄ¡£
Ö÷º¯ÊýÀïÃæÐèÒªÌí¼Ó£º
memcached_st *memc;
uint32_t&nbs ......
CÓïÑÔÖÐÓм¸¸ö»ù±¾ÊäÈ뺯Êý£º
//»ñÈ¡×Ö·ûϵÁÐ
int fgetc(FILE *stream);
int getc(FILE *stream);
int getchar(void);
//»ñÈ¡ÐÐϵÁÐ
char *fgets(char * restrict s, int n, FILE * restrict stream);
char *gets(char *s);//¿ÉÄܵ¼ÖÂÒç³ö£¬ÓÃfgets´úÌæÖ®¡£
//¸ñʽ»¯ÊäÈëϵÁÐ
int fscanf(FILE * r ......
ÏÈÇ°ÔÚ²âÊÔmysql connect c++½Ó¿ÚµÄʱºòÔËÐÐÆä¹Ù·½ÌṩµÄÀý×Ó
21.5.5.6. MySQL Connector/C++ Complete Example 2
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify ......
EBCDIC (Extended Binary Coded Decimal Interchange Code) À©Ôö¶þ½øʽʮ½ø½»»»Â룬ΪIBMÓÚ1963Äê£1964Äê¼äÍƳöµÄ×Ö·û±àÂë±í£¬¸ù¾ÝÔçÆÚ´ò¿×»úʽµÄ¶þ½ø»¯Ê®½øÊý(BCD, Bindary Coded Decimal)ÅÅÁжø³É¡£ÊÇIBMÃÔ¶û¼¶ÒÔÉϵçÄԵıê×¼Âë¡£
ASCII£¨American Standard Code for Information Interchange£¬ÃÀ¹úÐÅÏ¢»¥»»±ê×¼´úÂë£©Ê ......