Kamis, 07 April 2016

DIKTAT BAB 3 NO 1 C++

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

Tidak ada komentar:

Posting Komentar