-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (29 loc) · 750 Bytes
/
main.cpp
File metadata and controls
34 lines (29 loc) · 750 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
#include <iostream>
#include <building.h>
int main(int argc , char** argv)
{
std::cout << "Welcome to SimTown ! Please enter the street size" << std::endl;
int size{0};
std::cin>>size;
Building* street = new Building[size];
for (int ib=0; ib<size ; ++ib)
{
street[ib]= Building(ib);
}
//Resize array
Building* bigger_street = new Building[size+1];
for(int i=0; i<size ; ++i)
bigger_street[i]= street[i];
delete[] street;
street=bigger_street;
Building city_hall(1000);
Building new_city_hall(city_hall); //Test Copy Constructor
street[size++]=new_city_hall;
for (int i=0; i<size ; ++i)
{
street[i].print(std::cout);
}
delete[] street;
std::cout << "Done"<<std::endl;
return 0;
}