-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbagExample.c
136 lines (117 loc) · 2.58 KB
/
bagExample.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* Apparently a Linked List */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
int a;
main(){
while(1){
menu();
}
}
menu(){
printf("==VirtuMaxBag Menu==\n
1 - Displays list size\n
2 - Checks if list is full\n
3 - Checks if list is empty\n
4 - Add item to list\n
5 - Remove item from list\n
6 - Display all list items\n
7 - Count number of dupilcate items\n
8 - Display occurrences of specific item\n
9 - Check if list contains item\n
10 - Convert list to array\n
11 - Display first and last items\n
12 - Initilize list with Dog Cat Fish Rabbit Cow\n
13 - Remove second element of list\n
0 - Quit\n");
scanf("%d", &a);
if(a==1){
printf("[1]Counting Items\n");
}else if(a==2){
printf("[2]Checking If Full\n");
}else if (a==3){
printf("[3]Checking If Empty\n");
}else if (a==4){
printf("[4]Adding New Item\n");
}else if (a==5){
printf("[5]Removing Item\n");
}else if (a==6){
printf("[6]Displaying Full List\n");
}else if (a==7){
printf("[7]Counting Duplicates\n");
}else if (a==8){
printf("[8]Counting Occurrences\n");
}else if (a==9){
printf("[9]Checking If List Contains\n");
}else if (a==10){
printf("[10]Converting To Array\n");
}else if (a==11){
printf("[11]Displaying First And Last Items\n");
}else if (a==12){
printf("[12]Initializing With Set Items\n");
}else if (a==13){
printf("[13]Removeing Second Element\n");
}else if (a==0){
printf("Ending Program\n");
exit(0);
}else{
printf("Err: menu fuction not found\n");
}
return 0;
}
/*NODE Fuction*/
struct node(){
char data[10];
struct node *next;
};
struct node *head = NULL;
struct node *current = NULL;
int getSize(){/*1 on menu*/
int length = 0;
struct node *current;
for(current = head; current != NULL; current->next){
length++
}
return length;
}
void isFull(){/*2 on menu*/
printf("Can't Be Full\n");
}
bool isEmpty(){/*3 on menu*/
return head == NULL;
}
void add(char data[]){/*4 on menu*/
struct node *link = (struct node*) malloc(sizeof(struct node));
link->data = data;//do i need [] on first data?
link->next = head;
head = link;
}
struct node* remove(){/*5 on menu*/
struct node* current = head;
if(head == NULL){
return NULL;
}
while(current->data != data)
}
void printList(){/*6 on menu*/
}
int getDoubles(){/*7 on menu*/
}
int getOccurrences(){/*8 on menu*/
}
void check(){/*9 on menu*/
}
void convertToArray(){/*10 on menu*/
}
void firstAndLast(){/*11 on menu*/
}
void initilizeWith(){/*12 on menu*/
add("Dog");
add("Cat");
add("Fish");
add("Rabbit");
add("Cow");
}
struct node* removeSecond(){/*13 on menu*/
}