0 / 0 / 0
Регистрация: 16.10.2010
Сообщений: 4
|
|
1 | |
найти х224.03.2011, 00:51. Показов 443. Ответов 0
Метки нет (Все метки)
помогите,пожалуйста, программа не считает х2,не могу понять почему
#include "StdAfx.h" #include <iostream.h> #include <math.h> const double eps=0.001; double f1(double x) { return x*x*x-3*x*x+12*x-12; } double f2(double x) { return 1/tan(x) -x/3; } void dix1(double a, double b) { double c=(a+b)/2; while(fabs(f1(c))>eps) { if (f1(c)*f1(a)<0) b=c; else a=c; c=(a+b)/2; } cout<<"x1= "<<c<<endl; } void dix2(double a, double b) { double c=(a+b)/2; while(fabs(f2(c))>eps) { if (f2(c)*f2(a)<0) b=c; else a=c; c=(a+b)/2; } cout<<"x2= "<< c<<endl; } int main(int argc, char* argv[]) { double a1,a2; double b1,b2; cout<<"Vvedite a1:"<<endl; cin>>a1; cout<<"Vvedite b1:"<<endl; cin>>b1; cout<<"Vvedite a2:"<<endl; cin>>a2; cout<<"Vvedite b2:"<<endl; cin>>b2; dix1(a1,b1); dix2(a2,b2); return 0; }
0
|
24.03.2011, 00:51 | |
Ответы с готовыми решениями:
0
как сложить/умножить/найти большее/найти меньшее/найти средние число Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |
24.03.2011, 00:51 | |