রবিবার, ১৬ আগস্ট, ২০১৫

C programming project on caontact management system

//a project on cantact management system

#include<stdio.h>

void view(void);
void input(void);
void help(void);

struct input
{
    char name[15];
    char phone[15];
    char email[15];
}
people[100];
int i;

main()
{
    system("cls");
    system("color f9");
    int n,j;

    printf("\n\n");
    printf("Welcome to hallo world");
   //Ripon das
    printf("Welcome to Contact Management system..\n");
    printf("----------------------------------------------------\n");
    printf("\nPlease enter 1 for add contact.\n");
    printf("Please enter 2 for view contact.\n");
    printf("Please enter 3 for HELP\n");
    printf("Please enter 4 for exit\n");
    printf("----------------------------------------------------\n");
    scanf("%d",&n);

    while(n!=4)
    {
        switch(n)
        {
        case 1:
            input();
            break;
        case 2:
           view();
            break;
        case 3:
            help();
            break;

        default:
            printf("You enter wrong number. Please try again......");
            getch();
            main();

        }
    }
}
//Prepared by: Ripon das, CSE, University of Barisal

void input(void)
{
    system("cls");
    int n,i;
    FILE *f1;
    f1=fopen("Record file.txt","a");
    printf("How many data do you want?");
    scanf("%d",&n);
    printf("Please enter the data of %d people:",n);
    for(i=0;i<n;i++)

    {
       printf("\nEnter name %d (should one word):",i+1);

       scanf("%s",people[i].name);
       printf("\nEnter Mobile Number:");
       scanf("%s",people[i].phone);
       printf("\nEnter E-mail:");
       scanf("%s",people[i].email);
       fprintf(f1,"\n Name %d is: %s",i+1,people[i].name);
    fprintf(f1,"\nPhone Number is: %s",people[i].phone);
    fprintf(f1,"\n E-mail is: %s",people[i].email);
    }
    fclose(f1);
   main();
}

void view(void)
{
    system("cls");
    char c;

    FILE *f1;

    f1=fopen("Record file.txt","r");
    while((c=getc(f1))!=EOF)
        printf("%c",c);

    fclose(f1);
    printf("\nEnter any key to continue.........");
    getch();
    main();

}


void help(void)
{
    char ch;

    FILE *f2;
    f2=fopen("help.txt","r");
    while((ch=getc(f2))!=EOF)
    printf("%c",ch);
    fclose(f2);
    printf("\n\n\nEnter any key to continue.....");
    getch();
    main();
}

Related Posts

C programming project on caontact management system
4/ 5
Oleh

Subscribe via email

Like the post above? Please subscribe to the latest posts directly via email.