Teknik Komputasi >> Interpolasi Linier

// Interpolasi Linier
# include <stdio.h>
# include <math.h>
# include <conio.h>
# include <iostream.h>

float x1, y1, x2, y2, x,y ;

void main ( )
{
   cout<<"****** PROGRAM INTERPOLASI LINIER *******\n";
cout<<"\nInput data x[1] = "; cin>>x1;
   cout<<"Input data y[1] = "; cin>>y1;
   cout<<"Input data x[2] = "; cin>>x2;
   cout<<"Input data y[2] = "; cin>>y2;
  cout<<"\nInput x = "; cin>>x;

y = ((y2 - y1) / (x2 - x1))*(x - x1)+ y1;

cout<<"\nHasil perhitungan y = "<<y<<endl;
   cout<<"\nTitik Terbaru adalah ("<<x<<" , "<<y<<" )";
   getch();
}

Berkomentar yang sopan ya, Terimakasih sahabat..
EmoticonEmoticon