Mencari titik tengah sebuah garis

Algoritma :

  1. Masukkan A(x1)
  2. Masukkan A(y1)
  3. Masukkan B(x2)
  4. Masukkan B(y2)
  5. Titik tengah = (x1+x2)/2 , (y1+y2)/2

Program :

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

using namespace std;

int main(){
int x1,x2,y1,y2;

cout<<"Masukkan A(x1) = "
cin>>x1;
cout<<"Masukkan A(y1) = "
cin>>y1;
cout<<"Masukkan B(x2) = "
cin>>x2;
cout<<"Masukkan B(y2) = "
cin>>y2;
cout<<"Titik tengah = ("<<(x1+x2)/2<<","<<(y1+y2)/2<<")";

getch();
return 0;
}

Output :

Posted on Maret 23, 2011, in Tugas PTI. Bookmark the permalink. Tinggalkan komentar.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: