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

C_ÔËÓÃdo

 Ô´Â룺
# include <math.h>
# include <stdio.h>    /* Êýѧº¯Êý¿â */
 
int main()
{
    /* ÓÃs±íʾ¶àÏîʽµÄÖµ£¬ÓÃt±íʾÿһÏîµÄÖµ */
    double s, t, x; // ´Ë´¦ÓÃË«¾«¶ÈÉùÃ÷±äÁ¿
    int n;
    printf("please input x: ");
    scanf("%lf", &x); // £¥lf ´ú±íÓÃË«¾«¶ÈÊäÈë
    /* ¸³³õÖµ */
    t = x;
    n = 1;
    s = x;
    /* ½øÐеþ¼ÓÔËËã */
    do
    {
        n = n + 2 ;
        t = t * (-x*x)/((float)(n)-1)/(float)(n);
        s = s + t;
    } while (fabs(t)>=1e-8); // ±¾À´ÊÇÒª´óÓÚ0,µ«Ò²¿É´óÓÚÒ»¸öºÜСµÄÊý¼´¿É
    printf("sin(%f) = %lf\n", x, s);
    return 0;
}


Ïà¹ØÎĵµ£º

cÄÚ´æ·ÖÅä

ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
£¨1£© ´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ­·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄ
Õû¸öÔËÐÐÆڼ䶼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static ±äÁ¿¡£
£¨2£© ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯
ÊýÖ´ÐнáÊøʱÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ´¦ÀíÆ÷µÄÖ¸Áî¼ ......

C/C++ʱ¼äº¯ÊýʹÓ÷½·¨£¨×ª£©

C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£×î½ü£¬ÔÚ¼¼ÊõȺÖÐÓкܶàÍøÓÑÒ²¶à´ÎÎʵ½¹ýC++ÓïÑÔÖжÔʱ¼äµÄ²Ù×÷¡¢»ñÈ¡ºÍÏÔʾµÈµÈµÄÎÊÌâ¡£ÏÂÃ棬ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕß½«Ö÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨.
         ͨ¹ýѧϰÐí¶àC/C++¿â£¬Äã¿ÉÒÔÓкܶà²Ù×÷¡¢Ê¹ÓÃʱ¼äµÄ·½·¨¡£µ«Ô ......

C_תÒå×Ö·û

 Ô´Âë:
# include <stdio.h>
 
int main()
{
    /* »»Ðзû'\n'£¬ÓÃÓÚÊä³ö»»ÐÐ */
    printf("How are you?\n");
    printf("I am fine.\n\n");
 
    /* ºáÏòÌø¸ñ·û'\t'£¬Ê¹Ìøµ½ÏÂÒ»¸öÊä³öÇø */
  ......

C_×ÔÔöÓë×Ô¼õ

 Ô´Âë:
# include <stdio.h>
 
int main()
{
    int i, j, k;
    int m, n, p;
 
    i = 8;
    j = 10;
    k = 12;
    
    /* ×ÔÔöÔÚ²Ù×÷Êý֮ǰ */
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ