#include
#include
#include
#include
int main()
{
    FILE *p;
    char numstr[10];
    int i, salary ;
    struct  em {
      char name [10] ;
      int hp;
      int h;
    } emp ;
    clrscr() ;
    p = fopen("employ.dat", "wb+") ;
    if (!p) {
      printf("cannot open output file, press a key ...") ;
      getch() ;
      exit(1) ;
     }
     gotoxy(14, 2);
     puts("<< data entry >>");
     gotoxy(3, 3) ;
     printf("     name         hour pay   hour ") ;
     gotoxy(3,4) ;
     printf("----------       ---------   ------");
     i = 5 ;
     while (1) {
 gotoxy(3, i) ;
 gets(emp.name);
 if(!emp.name[0])
      break ;
 gotoxy(21, i) ;
 gets(numstr) ;
 emp.hp = atoi(numstr) ;
 gotoxy(34, i);
 gets(numstr) ;
 emp.h = atoi(numstr) ;
 i++ ;
 fwrite(&emp,sizeof(struct em), 1, p);
     } //end of while
     rewind(p) ;
     clrscr();
     gotoxy(7, 2) ;
     puts(" << OUTPUT >> " ) ;
     gotoxy(3,3) ;
     puts("  name           salary ");
     gotoxy(3,4);
     puts("----------      --------");
     i = 5 ;
     fread(&emp , sizeof(struct em), 1, p);
     while(!feof(p)) {
 gotoxy(3,i) ;
 puts(emp.name);
 gotoxy(21,i) ;
 printf("%d", emp.hp*emp.h) ;
 i++ ;
 fread(&emp,sizeof(struct em),1,p);
     }
     gotoxy(6, ++i) ;
     puts("press a key ...");
     getch() ;
   }