int main() { //construct 2d array to store students'records int stu[4][5]={{1232,10,23,45,56},{2343,45,43,24,78},{2345,34,45,45,45},{3423,67,6,65,56}}; //show menu int yourchoice; char confirm; displaymenu(); do { printf("Enter your choice(1-3):"); scanf("%d",&yourchoice); switch(yourchoice){ case 1:viewall(stu);break; case 2:viewbyid(stu);break; case 3:showhl(stu);break; default:printf("invalid"); } printf("Press y or Y to continue:"); scanf("%s", &confirm); }while(confirm=='y'||confirm=='Y'); system("PAUSE"); return 0; }
main() { int choice=0, i; printf("\t Welcome to 'MY PERSONAL Phone Book' \n"); while(choice!=5){ printf("\t=================================================\n"); printf("\t* Enter 1 to add a new contact. *\n"); printf("\t* Enter 2 to display all contacts. *\n"); printf("\t* Enter 3 to search a contact. *\n"); printf("\t* Enter 4 to delete all contacts. *\n"); printf("\t* Enter 5 to exit program *\n"); printf("\t=================================================\n"); scanf("%d", &choice); switch(choice){ case 1: addcontact(); break; case 2: viewall(); break; case 3: searchcontact(); break; case 4: reset(); i=0; break; case 5: printf("\nThank you for using 'My Personal Phone Book'\n Good Bye!!\n"); break; default: printf("Invalid Input\n"); } } }