-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathch07-arrayStackNoException-driver.cpp
More file actions
52 lines (43 loc) · 996 Bytes
/
ch07-arrayStackNoException-driver.cpp
File metadata and controls
52 lines (43 loc) · 996 Bytes
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
#pragma once
#include <iostream>
#include <string>
#include "ArrayStack.h"
#include "Car.h"
#include "Garage.h"
#include <fstream>
using namespace std;
void stackTester(Garage& garageClone,char car_Action_Doing, string license_Plate)
{
switch(car_Action_Doing)
{
case 'A':
//car arriving so add the car to the lane
garageClone.add_Car(license_Plate);
break;
case 'D':
garageClone.remove_Car(license_Plate);
break;
}
} // end stackTester
int main()
{
cout << "Testing the Array-Based Stack:" <<endl;
ifstream inFile;
inFile.open("TextFile1.txt");
string license;
char action;
//create a Garage
Garage controller;
while (!inFile.eof())
{
//read in car action doing and license plate number
inFile >> action >> license;
//send the garage created and details of car that just came in
stackTester(controller,action, license);
}
//print total number of times Cars moved
controller.print();
inFile.close();
system("PAUSE");
return 0;
} // end main