list code:
#include <iostream.h>
#include <math.h>
void Panjang(int x_1, int x_2, int y_1, int y_2)
{
float hasil;
if(x_2==x_1)
{
hasil = abs (y_2 - y_1);
}
else if (y_2==y_1)
{
hasil= abs (x_2-x_1);
}
else
{
hasil=sqrt((x_2-x_1)*(x_2-x_1) + (y_2-y_1)*(y_2-y_1));
}
cout<<"hasil = "<<hasil;
}
int main()
{
int a,b,c,d;
cout<<"Masukkan Nilai Xa : ";
cin>>a;
cout<<"Masukkan Nilai Xb : ";
cin>>b;
cout<<"Masukkan Nilai Ya : ";
cin>>c;
cout<<"Masukkan Nilai Yb : ";
cin>>d;
Panjang(a,b,c,d);
cout<<""<<endl;
cout<<""<<endl;
cout<<"terimakasih telah menggunakan aplikasi ini"<<endl;
cout<<"joffian"<<endl;
return 0;
}
prtscn:
0 komentar:
Posting Komentar