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
|
void manage_Rectangle_arr(string, Rectangle**&, short);
int main()
{
Rectangle * * arr;
short siArrayL=1;
manage_Rectangle_arr("make array", arr, siArrayL);
manage_Rectangle_arr("fill array", arr, siArrayL); //Problem here
manage_Rectangle_arr("get areas", arr, siArrayL); //Problem here
manage_Rectangle_arr("empty contents", arr, siArrayL); //Problem here
manage_Rectangle_arr("delete array", arr, siArrayL);
}
void manage_Rectangle_arr(string strCommand, Rectangle ** & arr, short siArrayL)
{
if(strCommand=="make array")
arr = new Rectangle * [ siArrayL];
if(strCommand=="fill array") //Problem here
for(short s=0; s< siArrayL; ++s)
arr[s]= new Rectangle(1, 1);
if(strCommand=="get areas") //Problem here
for(short s=0; s< siArrayL; ++s)
cout << arr[s]->getArea();
if(strCommand=="empty contents") //Problem here
for(short s=0; s< siArrayL; ++s)
delete arr[s];
if(strCommand=="delete array")
delete [] arr;
}
|