Running out of time

I have this due really soon and I have no time to spend on it! Is there any chance someone could do it for me? I know it is extremely selfish but I would be beyond grateful! Thank-you in advance!!!! This would really mean the world to me and would really save me!

I need to write a program that will define a dog structure to hold dog data. I have to make a date structure for the arrival dates and the dates of birth of the dogs, and an enumeration type breed for the dog breeds. I need to overload the stream insertion operator << to output variables of type dog. Place all user-defined type definitions and the prototypes of any overloaded operators in a file dog.h, and the definitions of the overloaded operators (their implementation) in a file dog.cpp. I need to write a main program which uses the dog structure to declare an array of dog data representing the dogs in the shelter. Then I need to initialize the array by reading from a text file. After initialization, the program should display the content of the array in a formatted table, using the overloaded stream insertion operator.

Please help! I can't tell you how much this would help me!
1
2
3
4
5
6
7
8
9
10
11
class Dog
{
     struct date_t
     {
           int day, month, year;
           };
     date_t arrival, birth;
     enum breed_t {dalmatian, boxer, bloodhound /*etc...*/};
     breed_t breed;
     ostream& operator<< (ostream& stm, Dog dog);
     }

I think you can do the rest yourself!
I don't believe this is enough for me. I am still stuck and its due today! Please help!
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
enum breed_t {dalmatian, boxer, bloodhound /*etc...*/};

operator breed_t(string x)
{
       switch(x)
       {
             case "dalmatian": return dalmatian; break;
             /*etc.*/
             }
       }

operator string(breed_t x)
{
       switch(x)
       {
             case dalmatian: return "dalmatian"; break;
             /*etc.*/
             }
       }

class Dog
{
     public:
     struct date_t
     {
           int day, month, year;
           date_t() :day(), month(), year();
           date_t (int a, int b, int c): day(a), month(b), year(c);
           };
     date_t arrival, birth;
     breed_t breed;
     ostream& operator<< (ostream& stm, Dog dog);
     Dog(): arrival(), birth();
     friend operator string(breed_t x);
     friend operator breed_t(string x);
     Dog(int a, int b, int c, int d, int e, int f, string x): arrival(a, b, c), brith(d, e, f)
     {
           breed=breed_t(x);
           }
     };

1
2
3
ostream& operator<<(ostream& stm, Dog dog)
{
       return stm<<dog.arrival.day<<"."<<dog.arrival.month<<"."<<dog.arrival.year<<"."<<"\t"<<dog.birth.day<<"."<<dog.birth.month<<"."<<dog.birthl.year<<"."<<"\t"<<string(dog.breed);

I think you can do the main() part yourself!
I can't :( could you help with that too?
Try it yourself and post back when you have a specific problem.
OK, here's the (almost)complete code!
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
enum breed_t {dalmatian, boxer, bloodhound /*etc...*/};

breed_t string_to_breed_t(string x)
{
       if (x=="dalmatian") return dalmatian;
       /*etc.*/
       }

string breed_t_to_string(breed_t x)
{
       switch(x)
       {
             case dalmatian: return "dalmatian"; break;
             /*etc.*/
             }
       }

class Dog
{
     public:
     struct date_t
     {
           int day, month, year;
           date_t() :day(), month(), year(){}
           date_t (int a, int b, int c): day(a), month(b), year(c){}
           };
     date_t arrival, birth;
     breed_t breed;
     ostream& operator<< (ostream& stm);
     ifstream& operator>> (ifstream& fin);
     Dog(): arrival(), birth(){}
     friend string breed_t_to_string(breed_t x);
     friend breed_t string_to_breed_t(string x);
     Dog(int a, int b, int c, int d, int e, int f, string x): arrival(a, b, c), birth(d, e, f)
     {
           breed=string_to_breed_t(x);
           }
     };

ostream& operator<<(ostream& stm, Dog dog)
{
       return stm<<dog.arrival.day<<"."<<dog.arrival.month<<"."<<dog.arrival.year
	   <<"."<<"\t"<<dog.birth.day<<"."<<dog.birth.month<<"."<<dog.birth.year
	   <<"."<<"\t"<<breed_t_to_string(dog.breed);
}

ifstream& operator>>(ifstream& fin, Dog& dog)
{
       string a;
	   fin>>dog.arrival.day>>dog.arrival.month>>dog.arrival.year
	   >>dog.birth.day>>dog.birth.month>>dog.birth.year>>a;
	   dog.breed=string_to_breed_t(a);
	   return fin;
}

int main()
{
	vector<Dog> array;
	Dog a;
	ifstream fin("sample.txt");
	do
	{
		fin>>a;
		array.push_back(a);
		} while (!fin.eof());
	for (auto a:array)
	{
		cout<<a<<endl;
		}
}

All you have to do is modify the enum breed_t and the conversion function, and change the file for the fin. And, don't complain to me how ios:eof is bad, I know it, but if you look at my overloaded operator, you'll see that I choose the lesser of the evils.
I hope this is enough for you.
I really appreciate all the work you did. I really really do!

I just need to figure out how to go about making the dog.h file.
Topic archived. No new replies allowed.