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
|
int main()
{
list<Ship*>myFleet;
list<Ship*>::iterator sItr;
Ship * p;
SubmergedShip * n;
///Initialize the entire fleet
p = new Ship("Aircraft Carrier", 'a', 10000, 10000, 50, false);
myFleet.push_back(p);
p = new Ship("Missle Cruiser", 'b', 6000, 8000, 30, false);
p->calculateBearing(10000, 10000);
myFleet.push_back(p);
p = new Ship("DDG", 'c', 14000, 8000, 30, true);
p->calculateBearing(10000, 10000);
myFleet.push_back(p);
p = new Ship("Frigate", 'd', 4000, 4000, 30, false);
p->calculateBearing(10000, 10000);
myFleet.push_back(p);
p = new Ship("DDG", 'e', 16000, 4000, 30, false);
p->calculateBearing(10000, 10000);
myFleet.push_back(p);
p = new Ship("Resupply", 'f', 4000, 0, 43, false);
p->calculateBearing(10000, 10000);
myFleet.push_back(p);
n = new SubmergedShip("Submarine", 'g', 10000, 5000, -350, 35, false);
n->calculateBearing(10000,10000);
myFleet.push_back(n);
delete p;
delete n;
for(sItr = myFleet.begin(); sItr != myFleet.end(); sItr++){
cout<<(*sItr)->getDesignation()<<endl;
}
|