-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.cpp
53 lines (45 loc) · 1.7 KB
/
functions.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
#include "functions.h"
void listt(Bus* array[],string x){
int i =0;
int y = 0;
while( array[i] != nullptr){
if(array[i]->getBusID() == x.substr(2,5)){
cout << "=======================================================================\n";
cout << "BUS ID\t\t" << "BUS MANUFACTURER\t" << "BUS CAPACITY\t" << "MILEAGE\t" <<setw(5) <<"Status" << endl;
cout << "=======================================================================\n";
cout << array[i]->getBusID() << "\t\t" << array[i]->getmanufacturer()
<< "\t\t" <<setw(5) <<array[i]->getCapacity() << "\t\t"<<array[i]-> getMileage() << "\t" << setw(5) <<array[i]->getStatus() << '\n';
cout << "---end of list---" << endl;
y++;
}
i++;
}
if(y <= 0)
cout << "Not Found" << endl;
}
void change(Bus* array[],string x){
int i = 0;
int y = 0;
while(array[i] != nullptr){
if(array[i]->getBusID() == x.substr(2,5)){
cout << "Change successful!" << endl;
array[i]->setStatus(x.c_str()[8]);
y++;
}
i++;
}
if(y <= 0)
cout <<"not Found" << endl;
}
void display(Bus * array[]){
int i = 0;
cout << "=======================================================================\n";
cout << "BUS ID\t\t" << "BUS MANUFACTURER\t" << "BUS CAPACITY\t" << "MILEAGE\t" <<setw(5) <<"Status" << endl;
cout << "=======================================================================\n";
while(array[i] != nullptr){
cout << array[i]->getBusID() << "\t\t" << array[i]->getmanufacturer()
<< "\t\t" <<setw(5) <<array[i]->getCapacity() << "\t\t"<<array[i]-> getMileage() << "\t" << setw(5) <<array[i]->getStatus() << '\n';
i++;
}
cout << "---end of list---" << endl;
}