menu bar

Saturday, 9 April 2016


analisis dan algoritma untuk mencari titik tengah sebuah garis yang ujung titiknya adalah A(x1,y1) dan B(x2,y2).






#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;}

dalam reptor



No comments:

Post a Comment