c³ÌÐòʵÏÖÏãÅ©±àÂë
#include <stdio.h>
#include <math.h>
#include <string.h>
int i,j,n,k,b;
float addp;
char bitw[20];
/*³õʼ»¯½á¹¹ÌåÆäÖУºsΪÐÅÔ´·ûºÅ£»pΪÐÅÔ´·ûºÅ¸ÅÂÊ£»paddΪÀÛ¼Ó¸ÅÂÊ£»
l_fΪ-log[p(s[i])]¼´¹À¼ÆÂë×Ö³¤¶È£»lΪʵ¼ÊÐèÒªÂë×Ö³¤¶È£»wΪÂë×Ö*/
struct shan
{char s[20];
float p;
float padd;
float l_f;
int l;
char w[20];
}data[12];
/*ÒÀÐÅÔ´¸ÅÂʶԸ÷ÐÅÔ´·ûºÅÅÅÐòMoai&KevinÔ´´£¡*/
void sequ(struct shan x[],int n)
{
struct shan temp;
for(i=0;i<n;i++)
for(j=i;j<n;j++)
{if(x[i].p<x[j].p)
{
temp=x[j];
x[j]=x[i];
x[i]=temp;
}
}
}
/*¼ÆËãÀÛ¼Ó¸ÅÂÊ*/
void countpadd(struct shan x[],int n)
{
addp=0;
x[0].padd=0;
for(i=0;i<n;i++)
{
addp+=x[i].p;
x[i+1].padd=addp;
}
}
/*¼ÆËã¹À¼ÆÂë×Ö³¤¶Èl_f£¬ÒÔ¼°Moai&KevinÔ´´£¡*/Âë×Ö³¤¶Èl*/
void count_l(struct shan x[],int n)
{
for(i=0;i<n;i++)
{
x[i].l_f=-log(x[i].p)/log(2);
if((x[i].l_f-(int)x[i].l_f)>0)
x[i].l=(int)x[i].l_f+1;
else x[i].l=(int)x[i].l_f;
}
}
/*¶þ½øÖÆ×ª»»*/
void covbit(float a,int lc)
{
for(j=0;j<lc;j++)
{
b=(int)(a*2);
bitw[j]=b+48;
a=2*a-int(a*2);
}
}
main()
{
printf("please input the number of symbols of source(n<=10):n=");
scanf("%d",&n);
printf("please input the the source symbols and their probabilities\n");
/*»ñÈ¡ÐÅÔ´·ûºÅ*/
for(i=0;i<n;i++)
{
scanf("%s",data[i].s);
}
/*»ñÈ¡ÐÅÔ´Moai&KevinÔ´´£¡*/¸ÅÂÊ*/
for(i=0;i<n;i++)
{printf("P(%s)=",data[i].s);
scanf("%f",&data[i].p);
}
sequ(data,n);
countpadd(data,n);
count_l(data,n);
/*ÔڽṹÌåÖвúÉúÂë×Ö*/
for(i=0;i<n;i++)
{
Ïà¹ØÎĵµ£º
Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸е쬻î»î»î£¡
&n ......
--Õª×Ô ¡¶Oracle Pro*C ³ÌÐò¿ª·¢¡· --Create/Modify Email£ºxingchengli@gmail.com
SQLDA µÄ½á¹¹ÈçÏ£º
struct SQLDA
{
long N; /* Descriptor size in number of entries */
char **V; Ptr to Arr of addresses of main variables */
long *L; /* Ptr to Arr of lengths of buffe ......
תÌù×Ô£ºhttp://blog.sina.com.cn/s/blog_629562fe0100gs2l.html
ÉÔ×÷ÐÞ¸Ä
gSOAPÊÇÒ»¸ö¿äƽ̨µÄ£¬ÓÃÓÚ¿ª·¢Web Service·þÎñ¶ËºÍ¿Í»§¶ËµÄ¹¤¾ß£¬ÔÚWindows¡¢Linux¡¢MAC OSºÍUNIXÏÂʹÓÃCºÍC++ÓïÑÔ±àÂ룬¼¯³ÉÁËSSL¹¦ÄÜ¡£
ÏÂÔØµØÖ·£ºhttp://sourceforge.net/projects/gsoap2
¹Ù·½ÍøÕ¾£ºhttp://genivia.com/Products/g ......
²Î¿¼ÍøÖ·£ºhttp://www.uclibc.org/
GNUµÄGlibcÊÇÒ»¸ö·Ç³£³è´ó¶øÍêÕûµÄ¿â£¬ÖÁÉÙ¶ÔÓÚǶÈëʽϵͳÀ´Ëµ£¬ÆäÌå»ýÏԵùýÓÚ´óÁËһЩ¡£uClibcµÄÌá³ö½ÏºÃµÄ½â¾öÁËÕâÑùÒ»¸öÎÊÌâ¡£uClibc¾¡¿ÉÄܵļæÈÝGlibc£¬´ó¶àÊýÓ¦ÓóÌÐò¿ÉÒÔÔÚºÜС»òÍêÈ«²»Ð޸ĵÄÇé¿öϾͿÉÄÜʹÓÃuClibcÌæ´úglibc¡£Í¨¹ýuClibcÀ´´úÌæGlibc£¬¿ÉÒÔÔÚ²»¸Ä±äÓ¦ÓóÌÐò¹¦Ä ......