-
Notifications
You must be signed in to change notification settings - Fork 0
/
AUTOMAIN.CPP
264 lines (258 loc) · 7.31 KB
/
AUTOMAIN.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include<string.h>
#include<fstream.h>
char auth[]={"123456789"};
class proc
{
public:
char check[9];
int i;
void back();
void fndelay();
char login();
void menu();
void out(char a[200],int size,char,char);
}begin;
class autoc: public proc
{
int ID,year;
char name[40],inventory[40],rating[5];
long double investment,profit,revenue,profitper;
int authtoken;
public:
char cat[30];
void view();
void add();
void modify();
void edit();
void category(char in[40]);
};
void autoc::category(char in[40])
{
char bodywork[5][10]={"Bumpers","Doors","Hood","Poof Panel","Mirrors"};
char structure[5][30]={"Superstructure","Door Reinforcers","Bumper Supports","Dashboard Cross Member","Front Cross Member"};
char steering[5][40]={"Wheels","Front and rear axles","steering wheel","Electric power-assisted steering","Springs and shock absorbers"};
char mechanical[7][30]={"Braking","Handbrake mechanism","Exhaust system","Heat shield","Tank","Engine-Gearbox","Transmission"};
char safety[11][30]={"Front headrest","Heat side airbags","Thorax side airbags","Seat belts","ImpactECU","Horn","Tyres","Tyre Pressure","Antiskid","Emergency Brake Assist","Seat Frame"};
char comfort[12][30]={"Carpets","Seats","Dashboard","Instrument Panel","Air Distribution","Air Conditioning","Lighting","Window Lift mechanism","Hood Opening","Sunroof","Wiper System","Washer fluid tank"};
char electricity[6][30]={"Headlamps","Dashboard wiring","Main wiring","Front wiring","Doors wiring"};
char aerodynamics[7][40]={"Front Bumper","Bumper flexible blade","Wheel arch covers","Fixed glazing partial flush-fitting","Rims","Mirrors","Tailgate top moulding"};
char environment[3][30]={"Exhaust","Engine","EGR"};
for(int i=0;i<5;i++)
if(strcmpi(in,bodywork[i])==0)
strcpy(cat,"Bodywork");
for(i=0;i<5;i++)
if(strcmpi(in,structure[i])==0)
strcpy(cat,"Structure");
for(i=0;i<5;i++)
if(strcmpi(in,steering[i])==0)
strcpy(cat,"Steering Axle");
for(i=0;i<7;i++)
if(strcmpi(in,mechanical[i])==0)
strcpy(cat,"Mechaninal Components");
for(i=0;i<11;i++)
if(strcmpi(in,safety[i])==0)
strcpy(cat,"Safety");
for(i=0;i<12;i++)
if(strcmpi(in,comfort[i])==0)
strcpy(cat,"Comfort");
for(i=0;i<6;i++)
if(strcmpi(in,electricity[i])==0)
strcpy(cat,"Electricity");
for(i=0;i<7;i++)
if(strcmpi(in,aerodynamics[i])==0)
strcpy(cat,"Aerodynamics");
for(i=0;i<3;i++)
if(strcmpi(in,environment[i])==0)
strcpy(cat,"Environment");
}
void autoc::view()
{
clrscr();
cout<<"test view";
getch();
}
void autoc::modify()
{
}
void autoc::add()
{
clrscr();
out("Welcome to the ADD Module!!",sizeof("Welcome to the ADD Module!!"),10,5);
out("Enter the name of the company",sizeof("Enter the name of the company"),10,6);
cin>>name;
out("Enter the year of joining",sizeof("Enter the year of joining"),10,7);
cin>>year;
out("Enter investment of company",sizeof("Enter investment of company"),10,8);
cin>>investment;
out("Enter the annual revenue of the company",sizeof("Enter the annual revenue of the company"),10,9);
cin>>revenue;
out("Enter the profit",sizeof("Enter the profit"),10,10);
cin>>profit;
profitper=(profit/investment)*100;
if(profitper<=20)
strcpy(rating,"*");
else if(profitper>20&&profitper<=40)
strcpy(rating,"**");
else if(profitper>40&&profitper<=60)
strcpy(rating,"***");
else if(profitper>60&&profitper<=80)
strcpy(rating,"****");
else if(profitper>80&&profitper<=100)
strcpy(rating,"*****");
out("Enter the Inventory",sizeof("Enter the Inventory"),10,5);
cin>>inventory;
category(inventory);
getch();
}
void autoc::edit()
{
clrscr();
cout<<"test edit";
getch();
}
void proc::back()
{
}
void proc::out(char a[200],int size,char x=10,char y=5)
{
gotoxy(x,y);
for(int i=0;i<size;i++)
{
cout<<a[i];
delay(50);
}
}
void proc::fndelay()
{
for(i=0;i<4;i++)
{
out(".....",sizeof("....."),10,6+i);
}
}
char proc::login()
{
start:
clrscr();
char ch;
out("Enter the system password!!!",sizeof("Enter the system password!!!"));
while(1)
{
ch=getch(); // 1
if(ch==13) // 2
break;
cout<<"*"; // 3
check[i++]=ch; //4
}
check[i]='\0';
if(strcmp(check,auth)==0)
{
clrscr();
out("Authenticated!!",sizeof("Authenticated!!"));
return 'y';
}
if(check!=auth)
{
clrscr();
strcpy(check,NULL);
out("Fatal Error!! Incorrect password, Please try again",sizeof("Fatal Error!! Incorrect password, Please try again"));
getch();
goto start;
}
return 'n';
}
void proc::menu()
{
clrscr();
out("Welcome to AutomobileLogistics ver-0.0.1",sizeof("Welcome to AutomobileLogistics ver-0.0.1"));
fndelay();
fndelay();
char ask='n';
do
{
int s=0;
clrscr();
out("What operation would you like to perform",sizeof("What operation would you like to perform"));
out("1.View company records",sizeof("1.View company records"),10,11);
out("2.Edit company records",sizeof("2.Edit company records"),10,12);
out("3.Add company record",sizeof("3.Add company record"),10,13);
out("4.Quit AutomobileLogistics ver-0.0.1",sizeof("4.Quit AutomobileLogistics ver-0.0.1"),10,14);
out("5.Help!!",sizeof("5.Help!!"),10,15);
cin>>s;
switch(s)
{
case 1:
autoc v;
v.view();
clrscr();
out("Do you want to return to main menu?(y/n)",sizeof("Do you want to return to main menu?(y/n)"));
cin>>ask;
break;
case 2:
autoc e;
e.edit();
clrscr();
out("Do you want to return to main menu?(y/n)",sizeof("Do you want to return to main menu?(y/n)"));cout<<"Do you want to return to main menu?(y/n)";
cin>>ask;
break;
case 3:
autoc a;
a.add();
ofstream fout;
fout.open("RECORD.dat",ios::binary);
fout.write((char*)&a,sizeof(a));
out("RECORD ADDED",sizeof("RECORD ADDED"));
fout.close();
clrscr();
out("Do you want to return to main menu?(y/n)",sizeof("Do you want to return to main menu?(y/n)"));
cin>>ask;
break;
case 4:
clrscr();
out("Are you sure you want to quit this program(y/n)?",sizeof("Are you sure you want to quit this program(y/n)?"));
cin>>ask;
if(ask=='y'||'Y')
ask='n';
else
ask='y';
clrscr();
out("Bye!!Bye!!",sizeof("Bye!!Bye!!"));
break;
case 5:
clrscr();
out("Searching databases",sizeof("Searching databases"));
fndelay();
cout<<endl;
out("Sorry for the inconvenience! This database is yet to be update",sizeof("Sorry for the inconvenience! This database is yet to be update"));
clrscr();
out("Do you want to return to main menu?(y/n)",sizeof("Sorry for the inconvenience! This database is yet to be update"));
cin>>ask;
clrscr();
break;
default:
out("Invalid Option!!",sizeof("Invalid Option!!"));
ask='n';break;
}
}while(ask=='y'||ask=='Y');
}
void main()
{
textbackground(BLUE);
char ch;
begin.back();
ch=begin.login();
getch();
if(ch=='y')
{
cout<<endl;
begin.out("Executing Program",sizeof("Executing Program"));
begin.fndelay();
begin.out("Press any key to enter program!!",sizeof("Press any key to enter program!!"),10,16);
getch();
begin.menu();
}
getch();
}