Algorithm or maths is very important for us
来源:互联网 发布:c语言打印杨辉三角8行 编辑:程序博客网 时间:2024/05/16 12:38
#include <algorithm.h>
int main()
{
floatf(float x);
floatxpoint(float x1,float x2);
floatroot(float x1,float x2);
floatx1,x2,f1,f2,x;
do
{
printf("input x1,x2:\n");
scanf("%f,%f",&x1,&x2);
f1 = f(x1);
f2 = f(x2);
}
while(f1*f2>=1e-6);
x = root(x1,x2);
printf("Aroot of equation is %8.4f\n",x);
return 0;
}
float f(float x)//f= x^3-5x^2+16x-80
{
floaty;
y =(((x-5.0)*x)+16.0)*x-80.0;
returny;
}
float xpoint (float x1,float x2)
{
floatx;
x = (x1*f(x2)-x2*f(x1))/(f(x2)-f(x1));
return x;
}
float root (float x1,float x2)
{
floatx,y,y1;
y1 =f(x1);
do
{
x = xpoint(x1,x2);
y = f(x);
if (y*y1>=0)
{
x1 =x;
y1 = y;
}
else
{
x2 =x;
}
}
while(fabs(y)>=0.00001);
return x;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
}
float f(float x)//f= x^3-5x^2+16x-80
{
}
float xpoint (float x1,float x2)
{
}
float root (float x1,float x2)
{
}
0 0
- Algorithm or maths is very important for us
- English is very important!
- Sum is very important!
- How to use libsvm for regression in matlab (It is very important)
- Analysis is very important! Twitter Portlet
- A very useful article for us about V4L2 API
- Very important URL
- English is Important for a software engineer
- Why is RAID So Important for Databases?
- Why Python is important for you
- plats christian louboutin there is a very important reason is that the identity of his 'special' --
- Android Bitmap's format and IplImage's format matching is very important
- linux 学习url-very important
- jQuery is not must for us--元素选取
- Why do we say English is important for an DBA.
- WHY VERSION CONTROL IS IMPORTANT FOR SOLO DEVELOPERS
- Why Playing is important For Excellent Time Management
- Why MSA Standard Is So Important for QSFP Transceiver?
- 大学必读
- 三月初三的萤火虫!
- 有一篇文章,共有3行文字,每行有8…
- 电文,按照a--z,b--y,A--Z,B--Y,…
- about gets and scanf
- Algorithm or maths is very important for us
- 写两个函数,分别求两个整数的最大公约数和最小公倍数
- 数组反转存储
- HTML中css和js链接版本号的用途
- 将两个字符串连接。解决了c语言输入出现溢出现象
- choose the longest word in the line .把字符串中最长的单词输出
- 给出年月日计算第几天。目的:熟悉以及简练闰年年份代码
- 输入10个职工姓名和职工号;按职工号从小到大排序并调整姓名顺序;输入工号查询姓名。
- 输入十六进制数输出相应的十进制数