struct Identification //function allows to enter in info when instructed to
{
string name;
string surname;
short age;
string phonenumber;
};
short peopleinDatabase;
Identification users[20];
int main(){
char test;
loadPeople();
do{
cout << "People in Database: " << peopleinDatabase << endl;
cout << "Press '1' to enter name." << endl;
cout << "Press '2' to view all individuals in the database" << endl;
cout << "Menu: "<< endl;
cout << "1. Add Individual" << endl;
cout << "2. Show All Individuals" << endl;
cout << "3. Save People to File" << endl;
cout << "4. Load People to File" << endl;
cout << "5. Search for Info in Database" << endl;
cout << "6. Remove person from database" << endl;
cout << endl;
test = getch(); // tells the console to wait until key is hit
switch(test)// will use as a directory of where to take the code if a user wants to do a certain thing
{
case '1':
addPerson();
break;
case '2':
showPerson();
break;
case '3':
savePeople();
break;
case '4':
loadPeople();
break;
case '5':
searchDatabase();
break;
case'6':
removePerson();
}
requireEntry();
system("cls");
} while(getch() != 27); //27 represents escape in ASCii table
return 0;
}
void requireEntry(){
cout << "Click Enter to continue" << endl;
while(getch() != 13); //allowss for different data pieces to not be skipped when entering in data 0
}
void addPerson(){ //function that will allow users to put in information for database
cout << "Enter name: ";
cin >> users[peopleinDatabase].name;