¾µäc/c++Ëã·¨
¶þ·Ö²éÕҵĴúÂë.
int bfind(int* a,int len,int val)
{
int m = len/2;
int l = 0;
int r = len;
while(l!=m && r!= m)
{
if(a[m] > val)
{
r = m;
m = (m+l)/2;
}
else if(a[m] < val)
{
l = m;
m = (m+r)/2;
}
else
return m;
}
return -1; //ûÓÐÕÒµ½
}
д³öÔÚĸ´®ÖвéÕÒ×Ó´®³öÏÖ´ÎÊýµÄ´úÂë.
int count1(char* str,char* s)
{
char* s1;
char* s2;
int count = 0;
while(*str!='\0')
{
s1 = str;
s2 = s;
while(*s2 == *s1&&(*s2!='\0')&&(*s1!='0'))
{
s2++;
s1++;
}
if(*s2 == '\0')
count++;
str++;
}
return count;
}
³öÏÖ´ÎÊýÏ൱Ƶ·±
ʵÏÖ
Ïà¹ØÎĵµ£º
½ñÌìÍê³ÉÁËǶÈëʽlinuxµÄµÚÒ»¸öÇý¶¯µÄ±àдºÍ²âÊÔ£¬ËäÈ»ÊǸö¼òµ¥µÄ³ÌÐò£¬µ«ÊÇÂéȸËäС£¬ÎåÔà¾ãÈ«£¬Ï£Íû¿ÉÒÔ¸ø¸Õ¿ªÊ¼½Ó´¥Çý¶¯±àдµÄÈËһЩÌáʾ£¬¹²Í¬½ø²½¡£
Ô´´úÂ룺
·ÖÎöÈçÏ£º
ÏÂÃæÊÇÎÒµÄÇý¶¯³ÌÐò£º
#include <linux/config.h>//ÅäÖÃÍ·Îļþ
#include <linux/kernel.h&g ......
C++ÓëJavaÒìͬ
1¡¢Ö¸Õë¡ï¡ï¡ï¡ï¡ï
C C++ÖеÄÖ¸Õ룬ÌṩÁ˺ܴóµÄÁé»îÐÔ£¬µ«ÊÇÁé»îÒ²´øÀ´ÁËΣÏÕ£¬¶ÔÖ¸Õë²Ù×÷µÄ²»µ±ÈÝÒ×Ôì³ÉÄÚ´æ鶻òÊÇ¿ÕÐüÖ¸ÕëµÈÎÊÌâ¡£
JavaÈ¡ÏûÁËÖ¸Õë¡£µ«Êµ¼ÊÉÏ£¬javaÖÐÉùÃ÷µÄËùÓÐÒýÓÃÊý¾ÝÀàÐ͵ÄÃû³Æ£¬¿ÉÒÔÀí½âΪ¾ÍÊÇÒ»¸öÖ¸Õë¡£¸ÃÃû³Æ´æ´¢ÔÚÕ»ÄÚ´æÉÏ£¬Ö¸Ïò¶ÔÄÚ´æÉÏʹÓÃnew¿ª±ÙµÄ¿Õ¼ä¡£
È磺
int[] ......
ACE×ÔÊÊÅäͨÐÅ»·¾³£¨ADAPTIVE Communication Environment£©ÊÇ¿ÉÒÔ×ÔÓÉʹÓᢿª·ÅÔ´ÂëµÄÃæÏò¶ÔÏó£¨OO£©¿ò¼Ü£¨Framework£©£¬ÔÚÆäÖÐʵÏÖÁËÐí¶àÓÃÓÚ²¢·¢Í¨ÐÅÈí¼þµÄºËÐÄģʽ¡£ACEÌṩÁËÒ»×é·á¸»µÄ¿É¸´ÓÃC++ Wrapper Facade£¨°ü×°Íâ¹Û£©ºÍ¿ò¼Ü×é¼þ£¬¿É¿çÔ½¶àÖÖƽ̨Íê³ÉͨÓõÄͨÐÅÈí¼þÈÎÎñ£¬ÆäÖаüÀ¨£ºÊ¼þ¶à··ÖÀëºÍʼþ´¦À ......
//ÊäÈëÒ»¸öÊý×飬ÔÙÐÞ¸ÄÕâ¸öÊý×éËùÓÐÔªËØ£¬ÈçºÎʵÏÖ£¿
int main()
{
vector<int> a;
int i(0);
while(cin>>i)
a.push_back(i);
//////////////////////////////////////////////////////Êä³ö½¨Á¢µÄÊý×飺
cout << "µÃµ½µÄÊý×éΪ£º" << ......