I am having a hard time getting this program (my homework assignment) to compile. I have looked it over a million times. The program is supose to read an inventory of an art gallery from "art.dat" into a struct (the Type and Place have to be enum types), and then a user has to be able to type in an artist name and get an output of all of the pieces of work that are listed for that artist.
I NEED HELP PLEASE!!! WHAT AM I DOING WRONG!!!
#include<iostream>
#include<fstream>
#include<cctype>
using namespace std;
enum Type {OIL, WATERCOLOR, PASTEL, ACRYLIC, PRINT, COLORPHOTO, BWPHOTO};
enum Place {MAIN, GREEN, BLUE, NORTH, SOUTH, ENTRY, BALCONY};
struct Size
{
int Height;
int Width;
};
struct ArtWork
{
string Artist;
string Title;
Type Medium;
Size WorkSize;
Place Room;
float Price;
};
const int MAX_ARTWORK = 120;
void search(ArtWork&);
int main()
{
char YN;
bool test;
ArtWork collection[MAX_ARTWORK];
ifstream inFile;
inFile.open("art.dat");
for(int i=0; i < MAX_ARTWORK; i++)
{
inFile.get(collection[i].Artist);
inFile.get(collection[i].Title);
inFile.get(collection[i].Medium);
inFile.get(collection[i].WorkSize);
inFile.get(collection[i].Room);
inFile.get(collection[i].Price);
}
test = true;
do
{
search(collection[]);
cout << "Would you like to look up another artist? (y/n)" << endl;
cin >> YN;
if (tolower(YN) == 'n')
{
inFile.close();
return 0;
}
} while (test == true);
}
void search(ArtWork&collection[])
{
string artist, medium, room;
int i;
cout << "Enter artist name: " << endl;
cin >> artist;
cout << "Artwork found by that Artist:" << endl;
for(i=0; i < MAX_ARTWORK; i++)
{
int count = 0;
if (collection[i].Artist == artist)
{
cout << "Title: " << collection[i].Title << endl;
switch (collection[i].Medium)
{
case OIL : medium = "Oil";
break;
case WATERCOLOR: medium = "Watercolor";
break;
case PASTEL: medium = "Pastel";
break;
case ACRYLIC: medium = "Acrylic";
break;
case PRINT: medium = "Print";
break;
case COLORPHOTO: medium = "Color Photo";
break;
case BWPHOTO: medium = "Black & White Photo";
}
cout << "Medium: " << medium << endl;
cout << "Work Size: " << collection[i].WorkSize.Height << "X" << collection[i].WorkSize.Width << endl;
switch (collection[i].Room)
{
case MAIN: room = "Main";
break;
case GREEN: room = "Green";
break;
case BLUE: room = "Blue";
break;
case NORTH: room = "North";
break;
case SOUTH: room = "South";
break;
case ENTRY: room = "Entry";
break;
case BALCONY: room = "Balcony";
}
cout << "Room: " << room << endl;
cout << "Price: " << collection[i].Price << endl;
count= count++;
}
}
if (count == 0)
cout << "There was no artwork found by that artist." << endl;
return;
}