#include #include using namespace std; // global variable storing the names and tel no. string names[100]; string tel[100]; int readFile(){ // read the names and tel no. from the text file int i=0; // count the total number of records read from the text file ifstream f("q7.txt"); do{ // .... }while(!f.eof()); // !f.eof() --> not end of file yet f.close(); return i-1; // avoid count extra record; } void writeFile(int total){ // save the updated data back to the text file for permanent storage } void listRecord(int total){ } int insertRecord(int total){ if(_________________){ cout << "The storage is full!" << endl; return __________; } else{ cout << "Inserting record..." << endl; // ... return __________; } } int deleteRecord(int total){ // declare some variables ... if(total==____){ cout << "The storage is empty" << endl; return ____; } else{ cout << "Deleting record..." << endl; // get the name to delete // ... // search the name // ... if(__________________){ cout << "Name Not Found" << endl; return _______________; } else{ // delete the name and tel // ... return _____; } } } void updateRecord(int total){ // declare some variables ... cout << "Updating record..." << endl; // get the name to update // ... // search the name // ... if(__________________){ cout << "Name Not Found" << endl; } else{ // print old tel // input new tel // update tel // ... } } int getMenuChoice(){ int choice; cout << "Telephone Enquiry System\n1) List Records\n2) Insert Record\n3) Delete Record\n4) Update Record\n5) Exit\n"; do{ cout << "Choice :"; cin >> choice; }while(choice<0||choice>5); return choice; } int main(){ int total, choice; total=readFile(); do{ choice=getMenuChoice(); if(choice==1) listRecord(total); else if(choice==2) total=total+insertRecord(total); else if(choice==3) total=total-deleteRecord(total); else if(choice==4) updateRecord(total); else writeFile(total); }while(choice!=5); return 0; }