i have tried, but am getting no where, i've spent hours on it, please help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2005
Posts: 18
Reputation: baboon4000 is an unknown quantity at this point 
Solved Threads: 0
baboon4000 baboon4000 is offline Offline
Newbie Poster

i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #1
Mar 22nd, 2005
hello, i need to hand this in this week, someone please help me :p
I need to do the followings:
1) allows user to add a new property to the collection
2) allows user to remove a property from the collection
3) allows the status to be changed from for sale to sold subject to contract
4) allows the asking price to be changed
5) displays a list of all unsold properties and their prices
6) allows a user to put in a maximum and minimum price and see all properties in that price range
7) allows a user to see all properties with gardens

As you can see I have started it, am confused on number 4, 5 , 6, 7. if someone could please help me on any of them, I would be really greatful.
you don't have to do all of them, even if you could just help me on number 4 that would be quite helpful too
Thanks
r
Attached Files
File Type: cpp building.cpp (1.6 KB, 4 views)
File Type: h building.h (328 Bytes, 3 views)
File Type: cpp flat.cpp (1.0 KB, 2 views)
File Type: cpp room.cpp (292 Bytes, 3 views)
File Type: h room.h (213 Bytes, 2 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,361
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 241
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #2
Mar 22nd, 2005
Could you post flat.h as well?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: baboon4000 is an unknown quantity at this point 
Solved Threads: 0
baboon4000 baboon4000 is offline Offline
Newbie Poster

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #3
Mar 22nd, 2005
am sorry, i have put the file.h in the file.cpp, because i was told that i can only have a maximum file of 5. here is file.h
//since i could only have a maximum of 5 files, you will need to create another header file called flat.h
#include <iostream.h>
#include "room.h"

class flat : public room
{
private :

int bathrooms;
int bedrooms;
int price;
int garden;

public :

flat();
void set_rooms(int bd, int ba, int pr, int gr);
void show_rooms();
void show_all();
};
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,361
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 241
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #4
Mar 22nd, 2005
Repackaged for interested parties as a standalone file:
  1. #include <iostream.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. ////////////////////////////////////////////////////////////////////////////////
  6. // room.h
  7. //
  8. class room
  9. {
  10. private :
  11.  
  12. int floor_no;
  13. int type; // 1 = Office : 2 = Flat
  14.  
  15. public :
  16.  
  17. room();
  18. void set_details(int floor_no, int type);
  19. void show_details();
  20. };
  21.  
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // room.cpp
  24. //
  25.  
  26. //#include "room.h"
  27.  
  28. room :: room()
  29. {
  30. floor_no = 0; //allocating memory
  31. type = 0;
  32. }
  33.  
  34. void room::set_details(int fn, int ty)
  35. {
  36. floor_no = fn;
  37. type = ty;
  38. }
  39.  
  40. void room::show_details()
  41. {
  42. cout<<"Floor number : " << floor_no << " Type : " << type << endl;
  43. }
  44.  
  45. ////////////////////////////////////////////////////////////////////////////////
  46. // flat.h
  47. //
  48.  
  49. //#include "room.h"
  50.  
  51. class flat : public room
  52. {
  53. private :
  54.  
  55. int bathrooms;
  56. int bedrooms;
  57. int price;
  58. int garden;
  59.  
  60. public :
  61.  
  62. flat();
  63. void set_rooms(int bd, int ba, int pr, int gr);
  64. void show_rooms();
  65. void show_all();
  66. };
  67.  
  68. ////////////////////////////////////////////////////////////////////////////////
  69. // flat.cpp
  70. //
  71.  
  72. //#include "flat.h"
  73.  
  74. flat :: flat()
  75. {
  76. bedrooms = 0;
  77. bathrooms = 0;
  78. }
  79.  
  80. void flat::set_rooms(int bd, int ba, int pr, int gr)
  81. {
  82. bedrooms = bd;
  83. bathrooms = ba;
  84. price = pr;
  85. garden = gr;
  86. }
  87.  
  88. void flat::show_rooms()
  89. {
  90. cout<<"Bedrooms : " << bedrooms << endl;
  91. cout<<"Bathrooms : " << bathrooms << endl;
  92. cout<<"price : " << price << endl;
  93. cout<<"number_of_gardens : " << garden << endl;
  94. }
  95.  
  96. void flat::show_all()
  97. {
  98. show_details();
  99. show_rooms();
  100. }
  101.  
  102. ////////////////////////////////////////////////////////////////////////////////
  103. // building.h
  104. //
  105.  
  106. //#include "flat.h"
  107.  
  108. class building
  109. {
  110. private :
  111.  
  112. char address[200];
  113. flat flats[20];
  114.  
  115. int no_flats;
  116.  
  117.  
  118. public :
  119.  
  120. building();
  121. void manage();
  122. void add_flat();
  123. void show_all_flats();
  124. void remove_flat();
  125. void price();
  126.  
  127. };
  128.  
  129. ////////////////////////////////////////////////////////////////////////////////
  130. // building.cpp
  131. //
  132.  
  133. //#include "building.h"
  134.  
  135. building :: building()
  136. {
  137. no_flats = 0;
  138.  
  139. }
  140.  
  141. void building::manage()
  142. {
  143. int option = -1;
  144. while (option != 0)
  145. {
  146. cout << " MAIN MENU " << endl;
  147. cout << " 0. Quit " << endl;
  148. cout << " 1. Add a Flat " << endl;
  149.  
  150.  
  151. cout << "\nEnter choice : ";
  152. cin >> option;
  153.  
  154. switch(option)
  155. {
  156. case 1 : add_flat();
  157. break;
  158. case 2: show_all_flats();
  159. break;
  160. case 3: remove_flat();
  161. break;
  162.  
  163. }
  164. }
  165. }
  166.  
  167. void building::add_flat()
  168. {
  169. int fn, bd, bh, pr, gr;
  170.  
  171. cout << "Enter Floor No : ";
  172. cin >> fn;
  173. cout << "Enter No bedrooms : ";
  174. cin >> bd;
  175. cout << "Enter No bathrooms : ";
  176. cin >> bh;
  177. cout << "Enter the price you wish to sell for :";
  178. cin >> pr;
  179. cout << "enter number of gardens :";
  180. cin >> gr;
  181. system("cls");
  182.  
  183. flats[no_flats].set_details(fn, 2);
  184. flats[no_flats].set_rooms(bd, bh, pr, gr);
  185. no_flats++;
  186. }
  187.  
  188. void building::show_all_flats()
  189. {
  190. for (int i = 0 ; i < no_flats ; i++)
  191. {
  192. cout << "FLAT " << i << " ==================\n";
  193. flats[i].show_all();
  194. cout << endl;
  195. }
  196. }
  197.  
  198. void building::remove_flat()
  199. {
  200. int flat_rem;
  201.  
  202. if (no_flats == 0)
  203. {
  204. cout << "There are no flats!!!\n";
  205. return;
  206. }
  207. cout << "Enter flat number to remove 0 - " << (no_flats - 1) << " : ";
  208. cin >> flat_rem;
  209. if (flat_rem >= 0 && flat_rem <= no_flats -1)
  210. {
  211. flats[flat_rem] = flats[no_flats - 1];
  212. no_flats--;
  213. cout << "Flat " << flat_rem << " was removed\n";
  214. }
  215. }
  216.  
  217.  
  218. void main()
  219. {
  220. building b;
  221. b.manage();
  222. cout<<"\n\nProgram Complete\n\n";
  223. }
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: baboon4000 is an unknown quantity at this point 
Solved Threads: 0
baboon4000 baboon4000 is offline Offline
Newbie Poster

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #5
Mar 23rd, 2005
that great, and thank you for that. what i really need and would be greatful is if you could please help me with creating these two codes.
A) allows the asking price to be changed

B) allows a user to see all properties with gardens

there must be someone who can help, please
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,361
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 241
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #6
Mar 23rd, 2005
Add a couple functions for modifying the flat.
  1. void flat::show_all_with_gardens()
  2. {
  3. if(garden)
  4. {
  5. show_details();
  6. show_rooms();
  7. }
  8. }
  9.  
  10. void flat::change_price()
  11. {
  12. cout<<"current price : " << price << "\nnew price? ";
  13. cin >>price;
  14. }
And add some for the building to deal with the flat.
  1. void building::show_all_flats_with_gardens()
  2. {
  3. for (int i = 0 ; i < no_flats ; i++)
  4. {
  5. cout << "FLAT " << i << " ==================\n";
  6. flats[i].show_all_with_gardens();
  7. cout << endl;
  8. }
  9. }
  10.  
  11. void building::price()
  12. {
  13. int flat_rem;
  14.  
  15. if (no_flats == 0)
  16. {
  17. cout << "There are no flats!!!\n";
  18. return;
  19. }
  20. cout << "Enter flat number to change price 0 - " << (no_flats - 1) << " : ";
  21. cin >> flat_rem;
  22. if (flat_rem >= 0 && flat_rem <= no_flats -1)
  23. {
  24. flats[flat_rem].change_price();
  25. }
  26. }
(Note that a fair amount of blind copy-and-paste-and-modify went on here.)

Then add some cases to your menu.
  1. void building::manage()
  2. {
  3. int option = -1;
  4. while (option != 0)
  5. {
  6. cout << " MAIN MENU " << endl;
  7. cout << " 0. Quit " << endl;
  8. cout << " 1. Add a Flat " << endl;
  9. cout << " 2. Show all Flats " << endl;
  10. cout << " 3. Remove a Flat " << endl;
  11. cout << " 4. Show all Flats with Gardens" << endl;
  12. cout << " 5. Change price " << endl;
  13.  
  14. cout << "\nEnter choice : ";
  15. cin >> option;
  16.  
  17. switch(option)
  18. {
  19. case 1 : add_flat();
  20. break;
  21. case 2: show_all_flats();
  22. break;
  23. case 3: remove_flat();
  24. break;
  25. case 4: show_all_flats_with_gardens();
  26. break;
  27. case 5: price();
  28. break;
  29.  
  30. }
  31. }
  32. }
I quick run looked like this.
  1. MAIN MENU
  2. 0. Quit
  3. 1. Add a Flat
  4. 2. Show all Flats
  5. 3. Remove a Flat
  6. 4. Show all Flats with Gardens
  7. 5. Change price
  8.  
  9. Enter choice : 1
  10. Enter Floor No : 1
  11. Enter No bedrooms : 3
  12. Enter No bathrooms : 2
  13. Enter the price you wish to sell for :1000
  14. enter number of gardens :1
  15. MAIN MENU
  16. 0. Quit
  17. 1. Add a Flat
  18. 2. Show all Flats
  19. 3. Remove a Flat
  20. 4. Show all Flats with Gardens
  21. 5. Change price
  22.  
  23. Enter choice : 1
  24. Enter Floor No : 2
  25. Enter No bedrooms : 4
  26. Enter No bathrooms : 2
  27. Enter the price you wish to sell for :1500
  28. enter number of gardens :0
  29. MAIN MENU
  30. 0. Quit
  31. 1. Add a Flat
  32. 2. Show all Flats
  33. 3. Remove a Flat
  34. 4. Show all Flats with Gardens
  35. 5. Change price
  36.  
  37. Enter choice : 2
  38. FLAT 0 ==================
  39. Floor number : 1 Type : 2
  40. Bedrooms : 3
  41. Bathrooms : 2
  42. price : 1000
  43. number_of_gardens : 1
  44.  
  45. FLAT 1 ==================
  46. Floor number : 2 Type : 2
  47. Bedrooms : 4
  48. Bathrooms : 2
  49. price : 1500
  50. number_of_gardens : 0
  51.  
  52. MAIN MENU
  53. 0. Quit
  54. 1. Add a Flat
  55. 2. Show all Flats
  56. 3. Remove a Flat
  57. 4. Show all Flats with Gardens
  58. 5. Change price
  59.  
  60. Enter choice : 4
  61. FLAT 0 ==================
  62. Floor number : 1 Type : 2
  63. Bedrooms : 3
  64. Bathrooms : 2
  65. price : 1000
  66. number_of_gardens : 1
  67.  
  68. FLAT 1 ==================
  69.  
  70. MAIN MENU
  71. 0. Quit
  72. 1. Add a Flat
  73. 2. Show all Flats
  74. 3. Remove a Flat
  75. 4. Show all Flats with Gardens
  76. 5. Change price
  77.  
  78. Enter choice : 5
  79. Enter flat number to change price 0 - 1 : 1
  80. current price : 1500
  81. new price? 1250
  82. MAIN MENU
  83. 0. Quit
  84. 1. Add a Flat
  85. 2. Show all Flats
  86. 3. Remove a Flat
  87. 4. Show all Flats with Gardens
  88. 5. Change price
  89.  
  90. Enter choice : 2
  91. FLAT 0 ==================
  92. Floor number : 1 Type : 2
  93. Bedrooms : 3
  94. Bathrooms : 2
  95. price : 1000
  96. number_of_gardens : 1
  97.  
  98. FLAT 1 ==================
  99. Floor number : 2 Type : 2
  100. Bedrooms : 4
  101. Bathrooms : 2
  102. price : 1250
  103. number_of_gardens : 0
  104.  
  105. MAIN MENU
  106. 0. Quit
  107. 1. Add a Flat
  108. 2. Show all Flats
  109. 3. Remove a Flat
  110. 4. Show all Flats with Gardens
  111. 5. Change price
  112.  
  113. Enter choice : 0
  114.  
  115.  
  116. Program Complete
Lather, rinse, repeat the procedure for the other items.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: baboon4000 is an unknown quantity at this point 
Solved Threads: 0
baboon4000 baboon4000 is offline Offline
Newbie Poster

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #7
Mar 24th, 2005
CAN SOME ONE PLEASE HELP, DAVE KINDLY HELP MEOUT ALOT, BUT I NEED SOME MORE HELP ESPECIALLY ON NUMBER 6 AND 3. I NEED TO HAND THIS WORK IN TODAY, IF I DON'T THERE WILL REDUCE 20 % OUT OF THE TOTAL MARK. PLEASE
3) allows the status to be changed from for sale to sold subject to contract

5) displays a list of all unsold properties and their prices

6) allows a user to put in a maximum and minimum price and see all properties in that price range
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: i have tried, but am getting no where, i've spent hours on it, please help

 
0
  #8
Mar 24th, 2005
Originally Posted by baboon4000
CAN SOME ONE PLEASE HELP, DAVE KINDLY HELP MEOUT ALOT, BUT I NEED SOME MORE HELP ESPECIALLY ON NUMBER 6 AND 3. I NEED TO HAND THIS WORK IN TODAY, IF I DON'T THERE WILL REDUCE 20 % OUT OF THE TOTAL MARK. PLEASE
Lay off the caps, there, friend-- no need to shout. I didn't see any code posted where you attempted that yourself. We can't help if you don't show some code to troubleshoot-- we're not here to write this stuff for you...
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: baboon4000 is an unknown quantity at this point 
Solved Threads: 0
baboon4000 baboon4000 is offline Offline
Newbie Poster

#3, and #6 please help

 
0
  #9
Mar 24th, 2005
can someone please help me with ony of the codes, especially # 6, 3

3) allows the status to be changed from for sale to sold subject to contract

5) displays a list of all unsold properties and their prices

6) allows a user to put in a maximum and minimum price and see all properties in that price range

  1.  
  2. //////////////////////////////////////////////////////////////////////////////////
  3. #include <iostream.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6.  
  7. ////////////////////////////////////////////////////////////////////////////////
  8.  
  9. class room
  10. {
  11. private :
  12.  
  13. int floor_no;
  14. int type; // 1 = Office : 2 = Flat
  15.  
  16. public :
  17.  
  18. room();
  19. void set_details(int floor_no, int type);
  20. void show_details();
  21. };

  1.  
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // room.cpp
  4.  
  5. //#include "room.h"
  6.  
  7. room :: room()
  8. {
  9. floor_no = 0; //allocating memory
  10. type = 0;
  11. }
  12.  
  13. void room::set_details(int fn, int ty)
  14. {
  15. floor_no = fn;
  16. type = ty;
  17. }
  18.  
  19. void room::show_details()
  20. {
  21. cout<<"Floor number : " << floor_no << " Type : " << type <<
  22. endl;
  23. }

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // flat.h
  3.  
  4. //#include "room.h"
  5.  
  6. class flat : public room
  7. {
  8. private :
  9.  
  10. int bathrooms;
  11. int bedrooms;
  12. int price;
  13. int garden;
  14.  
  15. public :
  16.  
  17. flat();
  18. void set_rooms(int bd, int ba, int pr, int gr);
  19. void show_rooms();
  20. void show_all();
  21. void show_all_with_gardens();
  22. void change_price();
  23. };

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // flat.cpp
  3.  
  4. //#include "flat.h"
  5.  
  6. flat :: flat()
  7. {
  8. bedrooms = 0;
  9. bathrooms = 0;
  10. }
  11.  
  12. void flat::set_rooms(int bd, int ba, int pr, int gr)
  13. {
  14. bedrooms = bd;
  15. bathrooms = ba;
  16. price = pr;
  17. garden = gr;
  18. }
  19.  
  20. void flat::show_rooms()
  21. {
  22. cout<<"Bedrooms : " << bedrooms << endl;
  23. cout<<"Bathrooms : " << bathrooms << endl;
  24. cout<<"price : " << price << endl;
  25. cout<<"number_of_gardens : " << garden << endl;
  26. }
  27.  
  28. void flat::show_all()
  29. {
  30. show_details();
  31. show_rooms();
  32. }

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // building.h
  3.  
  4. //#include "flat.h"
  5.  
  6. class building
  7. {
  8. private :
  9.  
  10. char address[200];
  11. flat flats[20];
  12.  
  13. int no_flats;
  14.  
  15.  
  16. public :
  17.  
  18. building();
  19. void manage();
  20. void add_flat();
  21. void show_all_flats();
  22. void remove_flat();
  23. void price();
  24. void show_all_flats_with_gardens();
  25.  
  26. };

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // building.cpp
  3.  
  4. //#include "building.h"
  5.  
  6. building :: building()
  7. {
  8. no_flats = 0;
  9.  
  10. }
  11.  
  12. void building::manage()
  13. {
  14. int option = -1;
  15. while (option != 0)
  16. {
  17. cout << " MAIN MENU " << endl;
  18. cout << " 0. Quit " << endl;
  19. cout << " 1. Add a Flat " << endl;
  20. cout << " 2. Show all Flats " << endl;
  21. cout << " 3. Remove a Flat " << endl;
  22. cout << " 4. Show all Flats with Gardens" << endl;
  23. cout << " 5. Change price " << endl;
  24.  
  25. cout << "\nEnter choice : ";
  26. cin >> option;
  27.  
  28. switch(option)
  29. {
  30. case 1 : add_flat();
  31. break;
  32. case 2: show_all_flats();
  33. break;
  34. case 3: remove_flat();
  35. break;
  36. case 4: show_all_flats_with_gardens();
  37. break;
  38. case 5: price();
  39. break;
  40.  
  41. }
  42. }
  43. }
  44.  
  45. void building::add_flat()
  46. {
  47. int fn, bd, bh, pr, gr;
  48.  
  49. cout << "Enter Floor No : ";
  50. cin >> fn;
  51. cout << "Enter No bedrooms : ";
  52. cin >> bd;
  53. cout << "Enter No bathrooms : ";
  54. cin >> bh;
  55. cout << "Enter the price you wish to sell for :";
  56. cin >> pr;
  57. cout << "enter number of gardens :";
  58. cin >> gr;
  59. system("cls");
  60.  
  61. flats[no_flats].set_details(fn, 2);
  62. flats[no_flats].set_rooms(bd, bh, pr, gr);
  63. no_flats++;
  64. }
  65.  
  66. void building::show_all_flats()
  67. {
  68. for (int i = 0 ; i < no_flats ; i++)
  69. {
  70. cout << "FLAT " << i << " ==================\n";
  71. flats[i].show_all();
  72. cout << endl;
  73. }
  74. }
  75.  
  76. void building::remove_flat()
  77. {
  78. int flat_rem;
  79.  
  80. if (no_flats == 0)
  81. {
  82. cout << "There are no flats!!!\n";
  83. return;
  84. }
  85. cout << "Enter flat number to remove 0 - " << (no_flats - 1) << " : ";
  86. cin >> flat_rem;
  87. if (flat_rem >= 0 && flat_rem <= no_flats -1)
  88. {
  89. flats[flat_rem] = flats[no_flats - 1];
  90. no_flats--;
  91. cout << "Flat " << flat_rem << " was removed\n";
  92. }
  93. }
  94.  
  95. void flat::show_all_with_gardens()
  96. {
  97. if(garden)
  98. {
  99. show_details();
  100. show_rooms();
  101. }
  102. }
  103.  
  104. void flat::change_price()
  105. {
  106. cout<<"current price : " << price << "\nnew price? ";
  107. cin >>price;
  108. }
  109.  
  110.  
  111. void building::show_all_flats_with_gardens()
  112. {
  113. for (int i = 0 ; i < no_flats ; i++)
  114. {
  115. cout << "FLAT " << i << " ==================\n";
  116. flats[i].show_all_with_gardens();
  117. cout << endl;
  118. }
  119. }
  120.  
  121. void building::price()
  122. {
  123. int flat_rem;
  124.  
  125. if (no_flats == 0)
  126. {
  127. cout << "There are no flats!!!\n";
  128. return;
  129. }
  130. cout << "Enter flat number to change price 0 - " << (no_flats - 1) << " : ";
  131. cin >> flat_rem;
  132. if (flat_rem >= 0 && flat_rem <= no_flats -1)
  133. {
  134. flats[flat_rem].change_price();
  135. }
  136. }
  137.  
  138.  
  139. void main()
  140. {
  141. building b;
  142. b.manage();
  143. cout<<"\n\nProgram Complete\n\n";
  144. }
Last edited by alc6379; Mar 25th, 2005 at 12:25 am. Reason: added [code] tags
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

Re: #3, and #6 please help

 
0
  #10
Mar 24th, 2005
in the interface you could make a switch . When veiwing a propetie you could have the user to have it for sale or sold.

This could be done by having an array of 5 characters and using the string copy command?

Just an idea
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC