this program has information about customers. this program has to perform the following functions.
- display list of all customers
- search by name
- search by id
- display list of customers having credit limit above 5000
- add new customers
i am unable to compile the program. here are the codes. can anyone fix it?
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define MAX=999
int i;
int id;
struct customer {
char custID[20];
char name[50];
char address[80];
char tell[15];
float credl;
};
int add_Name ();
int menu_Display ();
int get_Menu ();
int get_Option ();
int cust_id();
int cust_Name();
int main()
{
menu_Display ();
get_Menu ();
get_Option ();
getch();
return 0;
}
int menu_Display () {
int choice=0;
while (choice!=6) {
get_Menu ();
choice = get_Option();
}}
int get_Menu (){
int i;
for (i=0; i<1; i++) {
printf ("\t1. Display information of all customers\n\n");
printf ("\t2. Search for customer by Name\n\n");
printf ("\t3. Search for customer by ID\n\n");
printf ("\t4. Display a list of customers having credit limit above 5,000\n\n");
printf ("\t5. Add new customer\n\n");
printf ("\t6. Exit\n\n");
}
}
int get_Option () {
int option;
printf ("Please enter your option...");
scanf ("%d", &option);
}
int menu_Option (int option) {
int i;
switch (option) {
case 1 : cust_Name();
break;
case 2 : cust_id();
break;
case 3 : add_Name();
break;
case 6 : printf("The program will now exit\n");
break;
default : printf ("Sorry that does not exist");
i=getchar();
break;
}
}
int add_Name () {
int i;
struct customer xrecord[200];
for (i=0;i<1;i++)
{
strcpy(xrecord[i].custID,"ID00");
//strcpy(xrecord[i].custID,(strcat(xrecord[i].custID,i));
printf("Enter Name:");
scanf("\n%s",&(xrecord[i].name)) ;
printf("Enter address:");
printf ("\n");
scanf("\n%s",&(xrecord[i].address));
printf("Enter tell:");
scanf("\n%s",&(xrecord[i].tell));
printf("Enter credl:");
scanf("\n%f",&(xrecord[i].credl));
}
}
int cust_Name() {
int match;
int i;
int result;
int loop=0;
char name[20];
printf("Please enter the name which you are searching for\n");
gets(name);
while (match == 0 && i < MAX) {
result= strcmp(all_names[loop].name,name);
loop++;
}
if (loop == MAX) {
printf ("Match not found\n");
}
i=getchar();
}
int cust_id() {
int match;
int i;
int result=0;
int loop=0;
int id;
printf ("Please enter the id number which you are searching for\n");
scanf ("%d", &id);
while (match == 0 && i< MAX) {
result = strcmp (all_names[loop].id,id);
loop++;
}
if (loop == MAX) {
printf ("Match not found");
}
i = getchar();
}