-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpointMain.c
42 lines (39 loc) · 914 Bytes
/
pointMain.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
#include "point.h"
#include "boolean.h"
int main () {
int Choice,X,Y;
POINT P1,P2;
printf("--This is a driver for ADT Point--\n");
printf("List of commands: \n");
printf("1. Read two Points \n");
printf("2. Write two Points\n");
printf("3. EQ or NEQ\n");
printf("4. Exit\n");
printf("Your command: ");
scanf("%d", &Choice);
while (Choice!=4) {
if (Choice==1) {
printf("Input the first point [X Y]: ");
BacaPOINT(&P1);
printf("Input the second point [X Y]: ");
BacaPOINT(&P2);
} else if (Choice==2){
TulisPOINT(P1);
TulisPOINT(P2);
} else if (Choice==3) {
if (EQ(P1,P2)) {
printf("These two points are equal\n");
} else if (NEQ(P1,P2)) {
printf("These two points are not equal\n");
} else {
printf("Undetermined\n");
}
} else {
printf("Wrong commands\n");
}
printf("Your command: ");
scanf("%d", &Choice);
}
return 0;
}