void searchcontact() { char nametofind[20], compare[20]; int position; printf("\t\tOBSERVE CASE SENTIVITY\n"); printf("\t\tCapitalized all first letters\n"); putchar('\n'); printf("\t\tEnter name of the contact to search: "); scanf("%s", nametofind); putchar('\n'); putchar('\n'); for ( position=0; position<list; position++ ) { if ( strcmp( nametofind, contact[position].name.fname )==0 ) { printf("\t\t%s has the following information:\n", nametofind); putchar('\n'); display_contact(contact[position]); strcpy( compare, contact[position].name.fname); } } if ( strcmp( nametofind, compare )==0 ) { putchar('\n'); putchar('\n'); printf("\t\t-----------------------------------------------\n"); printf("\t\tThank you for using 'My Personal Phone Book!\n"); printf("\t\tPlease choose another option.\n"); printf("\t\t-----------------------------------------------\n"); putchar('\n'); putchar('\n'); } else { printf("\t\t-----------------------------------------------\n"); printf("\t\tE R R O R!\n"); printf("\t\tSorry but the name you entered is not in your list of contacts.\n"); printf("\t\tPlease try again using a different name.\n"); printf("\t\t-----------------------------------------------\n"); putchar('\n'); } }
void contacts_select_callback(int index, void *context) { display_contact(); }