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

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++)
 {


Ïà¹ØÎĵµ£º

Pro*C SQLDA ½á¹¹Ìå

--Õª×Ô ¡¶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 ......

NetBeans + MinGW µÄ C/C++ ¿ª·¢»·¾³ÅäÖÃ


Ç°ÃæµÄÎÄÕ¡¶´î½¨»ùÓÚ NetBeans µÄ OpenGL ¿ª·¢»·¾³¡·Ìáµ½ÁË NetBeans ºÍ MinGW µÄÅäÖ㬵±Ê±¼ÇµÃºÃÏñÒÔǰд¹ý²½Ö裬¾ÍËæÊÖÂÔ¹ýÁË¡£½ñÌìÊÕµ½ÍøÓѵÄÌáÐѲŷ¢ÏÖÊÇÎҼǴíÁË£¬ÔÚÕâÀï²¹ÉÏ£¬Í¬Ê±Ð»Ð»Ä㣡
¡¡¡¡²½ÖèÈçÏ£º
ÏÂÔØ×Ô¶¯ MinGW °²×°³ÌÐò£¬Õâ¶Ô³õѧÕßÀ´ËµÊDZȽϷ½±ãµÄ·½Ê½£¬È±µã¾ÍÊÇÏÂÔØËÙ¶ÈÂýµÃ²»ÈçÎÏÅ£¡£
ÔËÐ ......

A51: CALLING C FUNCTIONS from ASSEMBLY

ÒÔÏÂÈ«ÎÄ×ªÔØ×Ôhttp://www.keil.com/support/docs/697.htm                       Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Versio ......

´ÓC++µ½JAVA£¬C++³ÌÐòԱѧϰJAVAµÄÖ¸ÄÏ

write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
Technorati ±êÇ©: JAVA
,C++
,Python
JAVA is not just another programming language. -- ÄäÃû
ѧϰ¸üеÄÓïÑÔ£¬ÓÐÖúÓÚÁ˽â±ðÈ˶ԾÉÓïÑÔÓÐÄÄЩ²»Âú¡£ -- ÄäÃû
 
ǰÑÔ
ÏÈ
˵Ã÷±¾ÎĵÄÐÐÎÄϰ¹ß£¬ÎÄÕÂд×÷Á÷³ÌÒÔ±¾ÈËÔĶÁ¡¶Java Progra ......

C/C++ÓïÑÔ±à³ÌÐÞÑø2

21¡¢gotoÓï¾äµÄʹÓÃ
—————————
 
NÄêǰ£¬Èí¼þ¿ª·¢µÄÒ»´ú×Úʦ——µÏ½ÜË¹ÌØÀ­(Dijkstra)˵¹ý£º“goto statment is
harmful !!”£¬²¢½¨ÒéÈ¡ÏûgotoÓï¾ä¡£ÒòΪgotoÓï¾ä²»ÀûÓÚ³ÌÐò´úÂëµÄά»¤ÐÔ¡£
 
ÕâÀïÎÒҲǿÁÒ½¨Ò鲻ҪʹÓÃgo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ