一道C語言的程式設計題(龍貝格演算法)

2022-03-12 19:11:36 字數 2512 閱讀 1618

1樓:風兒不吹了

#include

#include

#define pi 3.14159265359double f(double x)

double romberg(double a, double b, double eps)

ep=fabs(q-y[m-1]);

y[m]=q;m++;n*=2;h*=.5;

}return q;

}void main()

ans=96.882985

會改f(x),你想算什麼都行

2樓:匿名使用者

#include "math.h"

#include "iostream.h"

double a,c; //設定全域性變數,便於fun()引用。

//求f(x)函式

double fun(double x);

int main(),q[100]=,h,shang,xia=0,tempp=0.0,x=0.0,e;

int r,y,j,k=0,i;

bool continu,flag=true;

e=0.0001;//設定精度

shang=1.5707963267; //積分上限h=shang-xia; //初始步長a=(2*r+y+j)/2; //橢圓長半軸c=(y-j)/2;

//初始t數表首項

p[0]=h/2*(fun(shang)+fun(xia));

do{//應用3.1公式求t[0][k]

k++;

h=h/2;

tempp=0.0;

//用flag標記,確定q,p陣列的的當前使用性//flag為真時,用q陣列記錄新產生資料if(flag){

嘿嘿 給我分 我把完整答案給你!!!

c語言程式設計:龍貝格法求積分,題目如圖:

3樓:

好牛的公式啊,這個公式從哪來的

可以轉化為級數,計算前幾項即可收斂

跪求c語言(不是c++)程式設計龍貝格求積分**

4樓:這是我小號

#include

#include

#include

double fx(double x)//被積函式double gets(double a,double b,double h)

return r2;

}int main()

問一道c語言程式設計題

5樓:匿名使用者

#include

int main(void)

printf("sum=%.3lf",sum);

}看看可以不

一道c語言題目

6樓:無憂網事

① p--

迴圈while(*p) p++;的作用是指標p指向字串末尾,指向'\0',而中止迴圈。

p--,就是再將指標p指向字串最後一個有效字元。即'\0'前面。

②*p=c

語句系列:c=*s;*s=*p;*p=c ;是經典的資料交換演算法,就是將*s(字串首字元)與*p(指標p指向的字元)交換,c在這裡是中間變數。

③ return

處理完整個字串,逆序操作結束。

功能測試通過了。

7樓:匿名使用者

用遞迴實現翻轉

p--*p='\0'

*p=c

8樓:匿名使用者

1.p--;

2.*p='\0';

3.*p=c;

我試了,這樣可以實現上面功能。

請教一道c語言程式設計題

9樓:匿名使用者

# include "stdio.h"

# include "stdlib.h"

typedef struct student* pstudent;

pstudent initialization(void);

void print(pstudent ph);

int len;

int main(void)

pstudent initialization(void)pstudent pt;

pt = ph;

pt->next = null;

printf("初始化進行中\n");

printf("請問一共有幾個學生:\n");

scanf("%d", &len);

for(int x = 0; x < len; x++)return ph;

}void print(pstudent ph)printf("\n所有學生資訊輸出完畢\n");

return;}/*

這裡只有兩門課程的成績,語文,數學,其他都ok了*/

求助一道C語言程式設計題,求助一道C語言程式設計題,題目如下

int max int a,int b,int c else if b a b c else if c a c b include int max int a,int b,int c int main return 0 附運dao行結果內 容 求助一道c語言程式設計題,題目如下 include in...

求一道C語言程式設計題,求助一道C語言程式設計題

char a 醋 a瓶裝醋 char b 醬油抄 b瓶裝醬襲油 char c c是一個空瓶子 strcpy c,a 先將a的醋放到c裡面strcpy a,b 再把b中醬油放到a裡面strcpy b,c 最後把原來放a中轉到c中的醋放到b中strcpy是一個字串複製語句 在前面加上標頭檔案 inclu...

一道c語言程式設計題,幫我看看,一道C語言程式設計題,幫我看看

參 其實來 寫的很不簡潔,if j 8 j 都自是多餘的,沒有什bai麼用,如果說有du用,僅僅是用來控制zhi迴圈次數 dao的,你可以向如下這樣寫。double fun double x 9 return sum 你的答案錯在i 9上,應該是i 9,也就是說只需迴圈8次,就可以了。我寫了一道c語...