求助,急用

来源:百度知道 编辑:UC知道 时间:2024/06/14 17:43:31
* 设计程序:对x=1,2,...,10,求函数f(x)=x-10*cos(x)-5*sin(x)的 */
/* 最大值,并将该数以格式"max=%.3f"输出。*/
#include <stdio.h>
#include <math.h>
void main()
{
float f(float), max, x;
/*
*
*
* 在这里添加代码
*
*
*/
}

#include <stdio.h>
#include <math.h>
void main()
{
float max, x;
int f[9];
for(x=1;x<=10;x++)
f[x-1]=x-10*cos(x)-5*sin(x);
for(x=1;x<=9;x++){
max=f[0];
if (max<f[x+1])
max=f[x+1];
}
printf("%f",max);
}
不知道行不行啊,还有什么地方不符合你的要求吗