-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
149 lines (131 loc) · 2.64 KB
/
main.cpp
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
137
138
139
140
141
142
143
144
145
146
147
148
149
#include"stdafx.h"
#include"Header.h"
#include"global_variables.h"
#include"function_define.h"
#include"main_variables.h"
#include"structs.h"
extern struct bill b[100];
using namespace std;
void q_number()
{
char user[10];
user[0] = NULL;//to store username.
cout << "\tEnter numbers :";
//to store password.
int i = 0;
char a;//a Temp char
for (i = 0;;)//infinite loop
{
a = getch();//stores char typed in a
//check if a is numeric or alphabet
if (a != 8 && a >= '0'&&a <= '9')
{
if (a != 13)
{
user[i] = a;//stores a in pass
++i;
cout << a;
}
}
if (a == '\b'&&i >= 1)//if user typed backspace
//i should be greater than 1.
{
cout << "\b \b";//rub the character behind the cursor.
--i;
}
if (a == '\r'&&user[0] != '\0')//if enter is pressed
{
user[i] = '\0';//null means end of string.
break;//break the loop
}
}
iquantity = atoi(user);
//here we can even check for minimum digits needed
/* if(i<=5)
{
cout<<"\nMinimum 6 digits needed.\nEnter Again";
getch();//It was not pausing :p
goto START;
}*/
}
void start()
{
while (true)
{
system("CLS");
clean();
cleanbill();
read();
read_bill();
text(15 on 8);
cout << "\n\n\n " << endl;
string str(coldstore);
int spaces = str.length();
cout << " ";
cout << "\r";
for (int i = 0; i < 60 - (spaces / 2); i++)
{
cout << " ";
}cout << coldstore << endl;
cout << " ";
text(0 on 8);
std::cout << "\r\t\t\t\t\t\t WELCOME TO COLD STORE" << endl;
text(15);
cout << "\n\t\t\t\t\t\t ";
text(8);
cout << "1.ADD-INVENTRY";
text(15);
cout << "\n\t\t\t\t\t\t ";
text(8);
cout << "2.SALE-PRODUCTS";
text(15);
cout << "\n\t\t\t\t\t\t ";
text(8);
cout << "3.SHOW-INVENTRY";
text(15);
cout << "\n\t\t\t\t\t\t ";
text(8);
cout << "4.BILL-REPORT" << endl;
text(15);
char opt;
cin >> opt;
if (opt == '1')
{
system("CLS");
addinv();
}
if (opt == '2')
{
system("CLS");
sale_product();
}
if (opt == '3')
{
system("CLS");
show_inventry();
}
if (opt == '4')
{
showbills();
}
}
}
int main()
{
system("CLS");
read_setup();
if (productkey != "xxxx-yyyy-xxxx-yyyy")
{
setup_agrement();
}
else
{
login();
}
clean();
cleanbill();
read();
read_bill();
start();
return 0;
}