Prog ran fine Friday, now won't work, don't know why
I left this prog working just fine on Friday. Now I want to run it, and I get all kinds of weird errors. I really have no clue why, any suggestions? It's really a very simple program, all it has to do is create 2 structs, then create 2 instances and print them out, first one by one, and then using the ostream & operator.
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
struct PERSON
{
char FirstName[20];
char LastName [20];
char Telephone[20];
char StreetAddress[50];
char Town[20];
char State[20];
int Zip;
};
struct LASTQUESTION
{
char Name[20];
int age;
char State[20];
}
ostream &operator << (ostream &os, const PERSON &x)
{
os << "This is using method from question 4" << endl
<< "First name: " << x.FirstName << endl
<< "Last Name: " << x.LastName << endl
<< "Telephone: " << x.Telephone << endl
<< "Street Address: " << x.StreetAddress << endl
<< "Town: " << x.Town << endl
<< "State: " << x.State << endl
<< "Zip: " << x.Zip << endl;
return os;
}
int main ()
{
PERSON prof;
strcpy(prof.FirstName,"Mr.");
strcpy(prof.LastName,"Harris");
strcpy(prof.Telephone, "1800555787");
strcpy(prof.StreetAddress, "1600 Pennsylvania Avenue");
strcpy(prof.Town, "Washington");
strcpy(prof.State, "DC");
prof.Zip = 20001;
PERSON stud;
strcpy(stud.FirstName,"Joe");
strcpy(stud.LastName,"Schmoe");
strcpy(stud.Telephone, "3018675309");
strcpy(stud.StreetAddress, "99 Red Balloons Ave");
strcpy(stud.Town, "Arlington");
strcpy(stud.State, "VA");
stud.Zip = 20812;
cout << "Professor Info (using method question 3)" << endl; //print out professor info question 3
cout << "First name: " << prof.FirstName << endl;
cout << "Last name: " << prof.LastName << endl;
cout << "Telephone: " << prof.Telephone << endl;
cout << "Street Address: " << prof.StreetAddress << endl;
cout << "Town: " << prof.Town << endl;
cout << "State: " << prof.State << endl;
cout << "Zip: " << prof.Zip << endl <<endl;
cout << "Student Info (using method question 3)" << endl; // print out student info question 3
cout << "First name: " << stud.FirstName << endl;
cout << "Last name: " << stud.LastName << endl;
cout << "Telephone: " << stud.Telephone << endl;
cout << "Street Address: " << stud.StreetAddress << endl;
cout << "Town: " << stud.Town << endl;
cout << "State: " << stud.State << endl;
cout << "Zip: " << stud.Zip << endl << endl;
cout << prof;
cout << stud;
return 0;
}