Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

CSC112 Spring 2016 Examples

2370 views
1
#include "jellypaca.h"
2
#include "eelpaca.h"
3
#include "FracasPack.h"
4
#include "../alpaca.h"
5
#include <sstream>
6
7
static int packNum = 0;
8
9
10
mtaylor::FracasPack::FracasPack()
11
{
12
std::ostringstream os;
13
14
//give the packa a unique name
15
os << "Ocean Pack " << packNum++;
16
packName=os.str();
17
18
//pack up 6 Ocean Critters!
19
for(int i=0; i<6; i++) {
20
21
if(i%2 == 0) {
22
//name and load a jelly
23
os.str(""); //reset
24
os << "Jellypaca #" << packNum-1 << "-" << i;
25
load(new Jellypaca(os.str(), this));
26
}
27
else{
28
//name and load a fishy
29
os.str(""); //reset
30
os << "Eelpaca #" << packNum-1 << "-" << i;
31
load(new Eelpaca(os.str(), this));
32
}
33
}
34
}
35
36
37
std::string
38
mtaylor::FracasPack::name()
39
{
40
return packName;
41
}
42
43