//#include #include #include #include "addressbook.h" using namespace std; /** * Class using **/ Addressbook::Addressbook() { // dbfile = "db.txt"; } void Addressbook::DisplayData() { ifstream file ("db.txt"); string line; if( file.is_open()) { cout << endl; while( file.good()){ getline(file,line); cout << line << endl; } } file.close(); } void Addressbook::AddRec(string newRec) { cout << "ADDED: " << newRec << endl; } /** * Functions **/ int main(int argc, char *argv[]) { bool looping; int opt; string msg; looping = true; while( looping) { cout << "+-----------------------------------------+" << endl; cout << "| |" << endl; cout << "| ADDRESSBOOK OPTION PANEL |" << endl ; cout << "| |" << endl; cout << "| 1- Add an address record |" << endl; // cout << "| 2- Update an address record |" << endl; // cout << "| 3- Delete an address record |" << endl; cout << "| 4- Display all of the address records |" << endl; // cout << "| 5- Search record |" << endl; cout << "| 6- Quit |" << endl; cout << "| |" << endl; cout << "+-----------------------------------------+" << endl; cout << "Enter option number: "; cin >> opt; Addressbook addr; string name; string address; string ph; string out; switch(opt) { case 1: cout << "Enter name and surname: "; getline(cin, name); cout << "enter address: "; getline(cin, address); cout << "enter phone number: "; getline(cin, ph); out = name + "#" + address + "#" + ph; addr.AddRec(out); /**/ break; case 4: addr.DisplayData(); break; case 6: return 1; break; default: msg = "You choosed default value"; break; } //cout << endl << msg << endl; cout << "You want to continue using program? (y=yes; n=no)"<> ans; if( ans == "y") { continue; } else { return 1; } }//while() }