struct contact
 {
  char name[20];
  char email[20];
  int hpnum;
 }add;
  FILE *f;
 void addcontact(struct contact list[3]);
 void savecontact(struct contact list[3]);
 int main (void)
 {
    int option,i;
    struct contact list[3];
do
{
    system("cls");
    printf("==========Welcome to Jeffery's Contact System Management==========\n");
    printf("\t\t\tContact System Main Menu\n");
    printf("[1] Create a New Contact\n");
    printf("[2] Modified Existing Contact\n");
    printf("[3] Delete Existing Contact\n");
    printf("[4] Search Existing Contact\n");
    printf("[5] Exit\n");
    printf("Please enter one of your option.\n");
    scanf("%d",&option);
    switch(option)
    {
        //add new contact
        case 1:addcontact(list);savecontact(list);
        break;
        case 2:
        case 3:
        case 4:for(i=0;i<3;i++)
               {
                   if(list[i].email!=0){
                        printf("\nContact Name: %s",list[i].name);
                        printf("\nHandphone Number: %d",list[i].hpnum);
                        printf("\nE-mail: %s",list[i].email);
                   }
               }
               getch();
               break;
        case 5:exit(EXIT_SUCCESS);
    }
}while(i=1);
getch();
}
void addcontact(struct contact list[3])
{
 char name[20],email[20];
 int hpnum,no=0;
 fflush(stdin);
 printf("\nContact Name: ");
 scanf("%s",list[no].name);
 fflush(stdin);
 printf("\nHandphone Number: ");
 scanf("%d",&list[no].hpnum);
 fflush(stdin);
 printf("\nE-mail: ");
 scanf("%s",list[no].email);
   }
   void savecontact(struct contact list[3])
 {
 FILE *f;
 f=fopen("contact.txt","w");
 fwrite(list,sizeof(list),3,f);
 fclose(f);
}
After I added the contact, it does store it when I searching back inside the cmd. And it included the weird word inside the searching contact section when I search the contact. besides, the txt file that it execute, it's nothing inside that what i wrote. It just consist the weird word.
 
     
     
    