The Way to Programming
The Way to Programming
#include#include #include #include struct contact{ int number; char name[100]; }; int isADD(struct contact add[10], int &x); void isDIS(struct contact add[10], int x); void isSER(struct contact add[10], int x); void main() { struct contact add[10]; int temp, i, x=0; char choice; back: do { fflush(stdin); printf("\nA = Add Contact\n"); printf("\nD = Display Contact\n"); printf("\nS = Search Contact\n"); printf("\nX = Exit Applikasyon\n"); printf("\nChoice:"); scanf("%c", &choice); switch(choice) { case 'a': case 'A': system("cls"); isADD(add, x); goto back; break; case 'd': case 'D': system("cls"); isDIS(add,x); getch(); system("cls"); break; case 's': case 'S': system("cls"); isSER(add,x); getch(); system("cls"); break; case 'x': case 'X': system("cls"); for(i=0;i<500;i++) { printf("%c", 2); } printf("BYE!"); for(i=0;i<500;i++) { printf("%c", 2); } printf("ay'g balik!"); for(i=0;i<450;i++) { printf("%c", 2); } printf("Joke lang!"); for(i=0;i<500;i++) { printf("%c", 2); } getch(); return; break; } }while(choice!='x' || choice!='X'); getch(); return; } int isADD(struct contact add[10], int &x) { printf("\nInput name:"); scanf("%s", add[x].name); printf("\nInput number:"); scanf("%d", &add[x].number); system("cls"); x++; return 1; } void isDIS(struct contact add[10],int x) { int d; printf("Name\t\tPhone Number\n"); for(d=0;d 0) { printf("\n%s\t\t%d", add[i].name,add[i].number); break; } else printf("No match FOUND!"); } }
I am having problem when searching for the strings in the function isSER.. I can’t think of anymore algorithms when searching for it…
Sign in to your account