All pastes #28599 Raw Edit

Handspider!

public text v1 · immutable
#28599 ·published 2005-11-13 20:44 UTC
rendered paste body
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>

using namespace std;

struct employee
       {
               string Name;
               int ID;
               char Salary;
               float payRate;
               string Department;
               string Title;
               
       };

int menu();
//Reads data from "empdata.txt" into an array of struct
int readEmployeeFile(employee e[]);  
//Sorts employee's in Ascending order
void sortEmployee(employee e[],int);
//Sorts employee's by ID # and department;
void sortByIdDepart(employee e[],int);
//Displays employees', by name, of a particular title 
void displayEmp(employee e[]);
//Prints to output file "empoutput.txt"
void printOut(employee e[]);

int main()
{
    int choice = 0;
    struct employee e[1];
    
	while(choice!=7)			
	{

	choice = menu();

	switch(choice)			//switch statement for menu items
	{
		case 1:
          
		break;

		case 2:
		break;

		case 3:
		break;

		case 4:
             
		break;

		case 5:
            
		break;

		case 6:
		break;

		case 7:
		break;

		default:
			cout << "PLEASE CHOOSE FROM OPTIONS 1-7." << endl << endl;
		break;
	};

	}

    return 0;
}

int menu()		
{
	int choice;
    cout << setw(80) << setfill('*') << "" << endl;
	cout << "1. Search for an employee by their ID number." << endl;
	cout << "2. Display employees' names according to salary." << endl;
	cout << "3. Group employees by department." << endl;
	cout << "4. Sort data by ascending order of employee ID numbers." << endl;
	cout << "5. List of employees sorted by ID # and department." << endl;
	cout << "6. Display employees, by name, of a particular title." << endl;
	cout << "7. Quit and Print." << endl << endl;
    cout << setw(80) << setfill('*') << "" << endl;
	cout << "Choose 1-7: ";
		cin >> choice;

	cout << endl;

	return choice;
}
int readEmployeeFile(employee e[])
	{
        int i = 0;
        ifstream fin("empdata.txt");
        
        while((fin) && (i < 14))
        {
            getline(fin,e[i].Name);
            fin >> e[i].ID;
        	fin.ignore();
			fin >> e[i].Salary;
			fin >> e[i].payRate;
			getline(fin,e[i].Department);
			fin.ignore();
			getline(fin,e[i].Title);
			fin.ignore();
			i++;	
		}

		return i-1;
     }
/*void sortEmployee(employee e[],int)
 {*/