Well, I need to write a program that uses enumerated datatypes, structs, and plenty of functions. Below is my current code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
void getInput(string input);
void outputStudent(string student);
void outputTeacher(string teacher);
void outputStaff(string staff);
void sendtoOutputStudents(string students);
struct personDataType
{
enum personType{student=0, teacher=1, staff=2};
string firstname, lastname, street, city, state;
int housenumber, zipcode;
};
int main()
{
return 0;
}
void getInput(string input)
{
ifstream fin;
fin.open("program6.txt");
if(fin.fail())
{
cerr << "Unable to find input file, program closing\n";
exit (2);
}
}
void outputStudent(string student)
{
getInput(input);
ofstream fout;
fout.open("student.txt");
if(fout.fail())
{
cerr << "Unable to open outputfile, program closing\n";
exit (3);
}
while(fin >> aNumber >> persontype.firstname >> persontype.lastname >> persontype.housenumber >> persontype.street >> persontype.city >> persontype.state >> persontype.zipcode)
{
if(aNumber==student)
{
sendtoOutputStudents(students)
fout << setw(10) << persontype.firstname << setw(10) << persontype.lastname << setw(10) << persontype.housenumber << setw(10) << persontype.street << setw(10) << persontype.city << setw(10) << persontype.state << setw(10) << persontype.zipcode)
}
}
}
void sendtoOutputStudents(string students)
{
fout << "Student\n" << setw(10) << "First Name" << setw(10) << "Last Name" << setw(10) << "House Number" << setw(10) << "Street" << setw(10) << "City" << setw(10) << "State" << setw(10) << "Zipcode" << endl;
}
Obviously, I'm not calling the struct right. Also, the function "getInput" doesn't work, at all. What am I doing wrong here? This is an assignment so doing it any other way would cost points.