5.Algoritma menentukan titik tengah{Baca kedua titik tersebut, kemudian output kan titik tengahnya}


#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
    float x1,y1,x2,y2,ttengahx,ttengahy;
    cout<<"Menghitung titik tengah 2 garis (x,y)"<<endl;
    cout<<"x1 = "; cin>>x1;
    cout<<"y1 = "; cin>>y1;
    cout<<"x2 = "; cin>>x2;
    cout<<"y2 = "; cin>>y2;
    ttengahx=(x1+x2)/2;
    ttengahy=(y1+y2)/2;
    cout<<"titik tengah 2 garis = "<<"("<<ttengahx<<"), ("<<ttengahy<<")";
    return 0;}
 

Previous
Next Post »
Copyright © 2015 Bettong'rs All Right Reserved
Created by Arlina Design Powered by Blogger