Monday, February 28, 2011

Coba Jawab Tugas Pemrograman IV - I.A

Mau coba jawab tugas pemrograman IV yang A ah, hehe . . . :D
isi dari beberapa method-methodnya kurang lebih ky gini:

Point MakePoint(float x, float y)
{
    Point P;
    P.x = x;
    P.y = y;
    return P;
}

void BacaPoint(Point* P) {
    cout << "x = "; scanf("%f", &P->x);
    cout << "y = "; scanf("%f", &P->y);
}

float GetAbsis(Point P){
    return P.x;
}

float GetOrdinat(Point P)
{
    return P.y;
}

void setAbsis(Point *P, float x)
{
    P->x = x;
}

void TulisPoint(Point P)
{
    printf("(%.f , %.f)", GetAbsis(P), GetOrdinat(P));
}

0 comments:

Post a Comment