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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include "main.h"
using namespace std;
list::list()
{
int size = 20;
int count = 0;
search_type = new char[size];
}
list::~list()
{
delete [] search_type;
}
void list::display_type(char type[],)
{
Posting post;
if (search_type)
delete [] search_type;
cout << "which type of post doy ou want to search for? (job, housing, sale, free): " << endl;
cin.getline(search_type, 20);
cin.ignore(20, '\n');
for (int i(0); i < list.count; i++)
{
if( strcmp (post[i].type, search_type) == 0)
{
cout << post[i].type << endl;
cout << post[i].title << endl; //This is where most of my errors stem from. referencing the variables that are in the private sector of my post class
cout << post[i].description << endl;
cout << post[i].email << endl;
if (strcmp (search_type, "job") == 0)
{
cout << "Wage: $" << post[i].pay << "Per hour " << endl;
cout << "Location at: " << post[i].location << endl;
}
if(strcmp (type, "housing") == 0)
{
cout << "Square feet: " << post[i].sqfeet << endl;
cout << "Bedrooms: " << post[i].rooms <<endl;
cout << "Bathrooms: " << post[i].bathrooms << endl;
cout << "Rent: $" << post[i].rent << endl;
cout << "Address: " << post[i].location << endl;
}
if (strcmp (type, "sale") == 0)
{
cout << "$" << post[i].cost << endl;
}
}
}
}
void list::display_all()
{
cout << post[i].type << endl;
cout << post[i].title << endl;
cout << post[i].description << endl;
cout << post[i].email << endl;
if (strcmp (search_type, "job") == 0)
{
cout << "Wage: $" << post[i].pay << "Per hour " << endl;
cout << "Location at: " << post[i].location << endl;
}
if(strcmp (type, "housing") == 0)
{
cout << "Square feet: " << post[i].sqfeet << endl;
cout << "Bedrooms: " << post[i].rooms <<endl;
cout << "Bathrooms: " post[i].bathrooms << endl;
cout << "Rent: $" << post[i].rent << endl;
cout << "Address: " << post[i].location << endl;
}
if (strcmp (type, "sale") == 0)
{
cout << "$" << post[i].cost << endl;
}
}
|