-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.c
More file actions
92 lines (57 loc) · 2 KB
/
code.c
File metadata and controls
92 lines (57 loc) · 2 KB
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "UpdateAndDelete.h"
#include "loginsystem.h"
#include "readCSV.h"
#define MAX_LINE_SIZE 256
#define MAX_NAME_SIZE 100
int main() {
int Validity = 0, Input, Status;
printf("Welcome to Cosmetic Shop!\n");
Status = login();
if (Status == 1) {
while (!Validity) {
printf("Show all products: Press 0\n");
printf("Create product(s): Press 1\n");
printf("Update or delete product(s): Press 2\n");
printf("Logout and exit: Press 3\n");
printf("Choose what to do: ");
if (scanf("%d", &Input) == 1 && Input == 0 || Input == 1 || Input == 2 || Input == 3) {
if (Input == 0) {
show(Status, 0);
} else if (Input == 1) {
create();
} else if (Input == 2) {
show(Status, 1);
} else {
return 0;
}
} else {
while (getchar() != '\n');
printf("You can only input 0, 1, or 2. Input again\n");
}
}
} if(Status == 2) {
while (!Validity) {
printf("Show all products: Press 0\n");
printf("Update or delete product(s): Press 1\n");
printf("Logout and exit: Press 2\n");
printf("Choose what to do: ");
if (scanf("%d", &Input) == 1 && Input == 0 || Input == 1 || Input == 2) {
if (Input == 0) {
show(Status, 0);
} else if (Input == 1) {
show(Status, 1);
} else {
return 0;
}
} else {
while (getchar() != '\n');
printf("You can only input 0 or 1. Input again\n");
printf("You can only input 0 or 1. Input again\n");
}
}
}
return 0;
}