Search Results

Search found 1 results on 1 pages for 'mizukage of meron 5'.

Page 1/1 | 1 

  • Telephone Directory

    - by Mizukage of Meron 5
    I need your help. We are ask to make a telephone directory program that asks your name, address, and telephone number. If the name you entered already exists, it will display that it already exists. This is what i have so far... #include<stdio.h> #include<conio.h> struct file { char name[25],address[25]; double telno; }; char tempname[25],tempadd[25]; double tempnum; int x; int choice; FILE *fp; main() { struct file rec; clrscr(); fp=fopen("TelDir.txt","a+"); while(!feof(fp)) { fscanf(fp,"%s %s %.0lf,&tempname,&tempadd,&tempnum); printf("\n%s\t\t%s\t\t\t%.0lf",tempname,tempadd,tempnum); printf("\nEnter Name: "); gets(rec.name); if(strcmp(rec.name,tempname)==1) { printf("\n\nALREADY EXIST!"); printf("\n%s\t\t%s\t\t\t%.0lf",tempname,tempadd,tempnum); getch(); } else { printf("Enter Address: "); scanf("%s",&rec.address); printf("Enter your Telephone No.: "); scanf("%lf",&rec.telno); printf("%s\t\t%s\t\t%\t\t0lf",rec.name,rec.address,rec.telno); fprintf(fp,"%s %s %.0lf\n",rec.name,rec.address,rec.telno); } } fclose(fp); getch(); } But this thing doesn't work. I don't know where the error is. Can someone help me on this? I would really appreciate if you could help me somehow.

    Read the article

1