X1235: Codewit Jessica: apartment hunting with C++ structs

Code along with Jessica's example and implement the algorithm that does the following:

  1. Prompts the user for "\nwhat is the name of the property\n" and gathers the user's response
  2. Prompts the user for "\nwhat is the value of the property\n" and gathers the user's response
  3. Prompts the user for "\nhow many rooms does the property have\n" and gathers the user's response
  4. Prompts the user for "\nis it available 1=true, 0=false\n" and gathers the user's response
  5. Prompts the user for "\ndo you want to enter another property y/n\n" and gathers the user's response
  6. Stores the values of the user's responses to 1-4 to describe a single property, added to a list of properties
  7. Repeat steps 1-6 as long as the user didn't enter 'n'
  8. After the user finished entering properties, display each property with:
    • Property's name, value, rooms, and availability, each with an endline following it.

To help with this task, you can assume the following struct as already been defined:

struct property{
  string name;
  double value;
  int rooms;
  bool availability;
};

Complete only the code within main's brackets { }

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.