-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueuelistMain.c
58 lines (55 loc) · 1.25 KB
/
queuelistMain.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "queuelist.h"
#include "point.h"
#include "boolean.h"
#include <stdlib.h>
#include <stdio.h>
int main () {
QueueU Q;
infotypeQU P;
int Choice;
printf("--This is a driver for ADT Queue List of Points--\n");
printf("List of commands: \n");
printf("1. IsEmpty() \n");
printf("2. IsOneElmt() \n");
printf("3. NbElmt() \n");
printf("4. Add Queue \n");
printf("5. Del Queue \n");
printf("6. RoundP () \n");
printf("7. Exit () \n");
CreateEmptyUQ(&Q);
printf("Your command: ");
scanf("%d", &Choice);
while (Choice != 7){
if (Choice==1){
if (IsEmptyUQ(Q)){
printf("Q is empty\n");
} else {
printf("Q is not empty\n");
}
} else if (Choice==2){
if (IsOneElmtUQ(Q) && !IsEmptyUQ(Q)){
printf("Q has one element\n");
} else {
printf("Q doesn't have only one element\n");
}
} else if (Choice==3){
printf("Number of element in Q : %d\n", NbElmtUQ(Q));
} else if (Choice==4){
printf("Input a point [X Y]: ");
BacaPOINT(&P);
AddQU(&Q,P);
} else if (Choice==5){
DelQU(&Q,&P);
printf("Deleted point is ");
TulisPOINT(P);
} else if (Choice==6){
RoundP(&Q);
printf("RoundP success\n");
} else {
printf("Wrong commands\n");
}
printf("Your command: ");
scanf("%d", &Choice);
}
return 0;
}