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

¿ª·¢ÓïÑÔ¤ÎC - C/C++ / CÓïÑÔ

¼ÆËã1-1/2+1/3-1/4+¡­+1/99-1/100+¡­,Ö±µ½×îºóÒ»ÏîµÄ¾ø¶ÔֵСÓÚ10-4Ϊֹ¡£
¿ª·¢ÓïÑÔ¤ÎC
Æ­ÈËÂ𣡲»ÒªÔÚÕâÑùÁË¡£
ÄãµÄÌâºÜ¼òµ¥µÄ£¬¿ÉϧÎÒ²»»á¡£
²»»á£¬²»»á£¬¾ÍÊDz»»á¡£

¸ßÊÖ°ï棺http://topic.csdn.net/u/20100514/22/a0306fbb-4006-49d3-b339-c3ef8eb347aa.html

¤ÎCÊÇʲô£¿CÓïÑÔÊÇÕâÑùµÄ...
C/C++ code:
/*¼ÆËã1-1/2+1/3-1/4+¡­+1/99-1/100+¡­,Ö±µ½×îºóÒ»ÏîµÄ¾ø¶ÔֵСÓÚ10-4Ϊֹ¡£*/
#include <stdio.h>
#include <math.h>

int main(void)
{
float sum=0,n=1,i=1;

while(fabs(i/n)>1e-4)
{
sum += i/n;
n++;
i = -i;
}
printf("%f\n",sum);

return 0;
}



ÎÒÓеãÔÎÔεĸоõ

[code=C/C++][/code]
#include <iostream>
using   namespace   std;
void   main()
{
int   i=1;
double   m,sum;
while(m> =10e-4)
{
if(i%2==0)
{m=1/i;sum=sum-m;}
else
{m=1/i;sum=sum+m;}
i++;
}
cout < <sum < <endl;
}
ÊÇC++³ÌÐò£¬Äã×Ô¼º¸Äһϰ¡

ÕæÊÇÎêÈèÁË¿ª·¢¶þ×Ö°¢

Â¥Ö÷Õâ¸ö¼òµ¥µÄ£¬£¬Â¥Ö÷ºÃºÃ¶¯¶¯ÄÔ½î

¿´ÁËÕâ¸öÌâ¾õµÃ¸Ã¸´Ï°Ò»Ï¸ߵÈÊýѧÁË


Ïà¹ØÎÊ´ð£º

execlÔõôµ÷ÓÃjava³ÌÐò - C/C++ / CÓïÑÔ

ÈçÌ⣬C/C++ÖеÄexeclÔõôµ÷ÓÃдºÃµÄjava³ÌÐò£¬
execl("/opt/java1.5/bin/java","MyClass",NULL);
ÕâÑùµÄ²»ÐÐŶ¡£

²»»á.

ÔËÐÐjava³ÌÐò
ÕÒ¹¤¾ß²é¿´Ò»ÏÂÄǸö³ÌÐòµÄÃüÁîÐÐ

ËÑË÷Ï£ºjni ......

Çó½Ìc/c++ÓïÑÔÏà¹ØÎÊÌâ - C/C++ / CÓïÑÔ

ÓÐÒ»10*10¾ØÕ󣬳ýÈ¥µÚÒ»¸öµã£¨0£¬0£©ºÍ×îºóÒ»µã£¨9£¬9£©£¬»¹Óа˸öµãΪ1£¬ÆäËû¶¼Îª0£¬ÒªÇóÓöþάÊý×é±íʾ¡£°Ë¸öµãÊÇËæ»úÉú³ÉµÄ£¬±àдÏà¹Ø³ÌÐò±íʾ¾ØÕóËùÓпÉÄÜÇé¿ö¡£
ÕæÐÄÇó½Ì¸÷λ¸ßÊÖ£¬°¥£¡±¾ÈËÌ«²ËÁË£¡ºÇºÇ£¡
......

C/C++ÖÐÓÐûÓиñʽ»¯UÅ̵ĺ¯Êý - C/C++ / C++ ÓïÑÔ

´ó¼ÒºÃ£º
ÎÒÏëʵÏÖ¼ì²âµ½²åÈëSD¿¨ºó×Ô¶¯½«SD¿¨¸ñʽ»¯µÄ¹¦ÄÜ£¬²»ÖªC/C++ÖÐÓÐûÓиñʽ»¯UÅ̵ĺ¯Êý£¿
ÁíÍ⣬ÎÒ²»ÏëʹÓÃSHFormatDrive£¬ÒòΪÕâ¸öº¯Êý»áµ¯³öÊÇ·ñÒª¸ñʽ»¯µÄÌáʾ¿ò£¬ÎÒÐèÒªµÄÊÇϵͳ×Ô¶¯¸ñʽ»¯£¬¶ø²Ù×÷Õß² ......

c¾²Ì¬±àÒëÁíÒ»¸öÎļþ¼ÐµÄ¿âº¯Êý - C/C++ / CÓïÑÔ

ÔÚ¸ùĿ¼/libÖдæ·ÅÒ»¸ölog.c£¬log.h£¬²¢ÓÃÏÂÃæµÄÓï¾ä£º
gcc -c log.c
ar crv liblog.a log.o
±àÒë³öÒ»¸öliblog.a¾²Ì¬¿â£¬È»ºóÔÚÎļþ¼Ð£º/testfileÖд´½¨Ò»¸ötest.cºÍtestc.c£¬test.cÖÐÒýÓÃÁËtestc.cÖж¨ÒåµÄ·½·¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ