Hi people.
I am doing some very basic objects work, trying to help a real life problem so to speak.
I have an array of pointer properties, which are storing residential, and commercial buildings.
I would like to get 3 more functions working properly, and any heplful souls i will give more info if needed.
1) trying to delete a property:
void agency::remove_property()
{
property* p;
long p_id;
clrscr();
cout <<"============== REMOVE A PROPERTY =================" <<endl <<endl;
cout <<"Enter the Property ID No. ";
cin >> p_id;
p = find_prop (p_id);
p->show();
pause ("Press any key to continue"
props[no_props] = p;
delete p;
p = props[no_props -1];
no_props --;
props[no_props] = NULL;
}
almost works however deletes the last stored property, and not the one i have entered the id for.
2)
The next one i want to display all residentials in-between two given input prices.
This doesnt work also but is nearly there:
void agency::disp_res_range()
{
int i;
long price;
long x;
long y;
clrscr();
cout <<"============ SHOW RESIDENTIAL PROPERTIES ==============" <<endl <<endl;
cout <<"Enter lower value: "<< endl;
//cin >> x;
cout <<"Enter higher value: "<< endl;
//cin >> y;
//(price >= x) && (price <= y))
for (i=0; i<no_props; ++i)
{
if ((props->get_r_range() == 1)) //&& ((price > x) & (price < y)))
{
clrscr();
cout <<"RESIDENCIES " <<i <<endl;
props->show();
pause ("Press any key to show next PROPERTY"
}
}
clrscr();
pause ("END OF UNSOLD PROPERTIES LIST - press any key to return to menu"
}
Thanks in advance, i will love it if anyone helps!
I am doing some very basic objects work, trying to help a real life problem so to speak.
I have an array of pointer properties, which are storing residential, and commercial buildings.
I would like to get 3 more functions working properly, and any heplful souls i will give more info if needed.
1) trying to delete a property:
void agency::remove_property()
{
property* p;
long p_id;
clrscr();
cout <<"============== REMOVE A PROPERTY =================" <<endl <<endl;
cout <<"Enter the Property ID No. ";
cin >> p_id;
p = find_prop (p_id);
p->show();
pause ("Press any key to continue"
props[no_props] = p;
delete p;
p = props[no_props -1];
no_props --;
props[no_props] = NULL;
}
almost works however deletes the last stored property, and not the one i have entered the id for.
2)
The next one i want to display all residentials in-between two given input prices.
This doesnt work also but is nearly there:
void agency::disp_res_range()
{
int i;
long price;
long x;
long y;
clrscr();
cout <<"============ SHOW RESIDENTIAL PROPERTIES ==============" <<endl <<endl;
cout <<"Enter lower value: "<< endl;
//cin >> x;
cout <<"Enter higher value: "<< endl;
//cin >> y;
//(price >= x) && (price <= y))
for (i=0; i<no_props; ++i)
{
if ((props->get_r_range() == 1)) //&& ((price > x) & (price < y)))
{
clrscr();
cout <<"RESIDENCIES " <<i <<endl;
props->show();
pause ("Press any key to show next PROPERTY"
}
}
clrscr();
pause ("END OF UNSOLD PROPERTIES LIST - press any key to return to menu"
}
Thanks in advance, i will love it if anyone helps!