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 71 72 73 74 75 76 77 78 79 80 81 82
|
#include <iostream>
#include <string>
#include <cstring>
#include "student.h"
#include "graduate.h"
#include "undergrad.h"
#include <fstream>
#include <iomanip>
using namespace std;
const string user = "grader";
const string password = "12345";
void adminLogin();
void Menu();
void exitProgram();
int main()
{
adminLogin();
return 0;
}
void adminLogin()
{
string name, pass;
cout << " CSU " << endl;
cout << " Adminsitrator Login " << endl;
cout << "-------------------------------------------" << endl;
cout << "Username: ";
cin >> name;
cout << "Password: ";
cin >> pass;
if (name == user & pass == password)
{
cout << "\nYou are logged in!";
Menu();
}
else
{
cout << "\nInvalid Username and/or Password..." << endl;
adminLogin();
}
}
void Menu()
{
//string sFName, sLName, sID, sM, scrM, scrTu, scrW, scrTh, scrF, cH, sY, sD, sTh;
string menuChoices[] = {"Display Student Records", "Edit Student Records",
"Search Student(first name)", "Exit Program"};
for(int z=0; z<4; z++)
{
cout << z+1 << "\t\t" << menuChoices[z] << endl;
}
int userChoice;
cout << "(Please enter a number) :";
cin >> userChoice;
switch (userChoice)
{
case 1:
fstream database("database.txt");
string textLine;
while (!database.eof())
{
getline (database, textLine);
cout << textLine << endl;
}
database.close();
break;
}
}
|