Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» Celebrity.Sex.Tape.UNCUT.&.UNRATED.2012.720p.BRrip.x264.YIFY.mp4
Tue Dec 17, 2013 8:32 am by titquarra

» Maya Autodesk Personal Learning Edition 8.5
Tue Dec 17, 2013 7:47 am by titquarra

» Tuyệt Kỹ Đong Giai Chân Kinh (tuyệt Kỹ cua trai)
Thu Aug 23, 2012 5:38 am by Admin

» Tuyệt kỹ cua giai
Thu Aug 23, 2012 5:36 am by Admin

» NETCAT.........
Mon Aug 13, 2012 6:35 am by Admin

» Bảo mật CSDL bằng phương pháp mã hóa.
Tue Apr 17, 2012 10:04 pm by Admin

» Hàm mã hóa MD5 bằng JavaScript
Tue Apr 17, 2012 10:03 pm by Admin

Shopmotion


Affiliates
free forum


Nội suy Newton

View previous topic View next topic Go down

Nội suy Newton

Post  Admin on Thu Jun 09, 2011 3:05 am

#include <conio.h>
#include <iostream.h>

#define M 50
#define n m-1

class BANGSO
{
private:
double x***91;M***93;;
double y***91;M***93;;
int m; //So moc noi suy
double bth***91;M***93;***91;M***93;; //Bang ty hieu (co bo sung them cot cac yi)
double b***91;M***93;; //Cac he so
void ty_hieu(); //Lap bang ty hieu cac cap
public:
void nhap(); //Nhap so lieu vao bang
void noi_suy(double);
};

void BANGSO::nhap()
{
//Tam thoi chua kiem tra tinh hop le cua so lieu
cout << "So moc noi suy:";
cin >> m;

while (m>M)
{
cout << "So ban nhap qua lon!"<<endl<<"Hay nhap so khac:";
cin >> m;
}

cout << "Bat dau nhap so lieu vao bang!" <<endl;
getch();

for (int i=0;i<=n;i++)
{
cout << 'x' << i << '=';
cin >> x***91;i***93;;
cout << endl;
cout << 'y' << i << '=';
cin >> y***91;i***93;;
cout << endl;
}

cout << "Da nhap xong so lieu vao bang!" << endl;
getch();
}

void BANGSO::ty_hieu()
{
int i,k;
for (i=0;i<=n;i++)
{
bth***91;i***93;***91;0***93;=y***91;i***93;;
}

for (k=1;k<=n;k++) //k la cap cua ty hieu
{
for (i=0;i<=n-k;i++)
{
bth***91;i***93;***91;k***93;=(bth***91;i+1***93;***91;k-1***93;-bth***91;i***93;***91;k-1***93;)/(x***91;i+k***93;-x***91;i***93;);
}
}
}

void BANGSO::noi_suy(double c)
{
int i,j;
ty_hieu();
for (i=0;i<=n;i++)
{
b***91;i***93;=bth***91;0***93;***91;i***93;;
}

//Tinh kq
double kq;
kq=b***91;0***93;;
for (i=1;i<=n;i++)
{
double t=b***91;i***93;;
for (j=0;j<=i-1;j++)
{
t*=(c-x***91;j***93;);
}
kq+=t;
}
cout << kq;
}

void main()
{
BANGSO bang1;
double c;

clrscr();
bang1.nhap();
cout << "c=";
cin >> c;
bang1.noi_suy(c);
getch();
}

Admin
Admin

Tổng số bài gửi : 782
Join date : 2009-08-15

View user profile http://hackis.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum