We provide Engineering,HSEB notes, tutorials which can be helpful for students during college life.
Tuesday, April 7, 2015
48. Write a program which reads name, department and age from a file named “employee.dat" display them on the monitor. [2069] [2070 Set D]
#include <stdio.h>
#include <conio.h>
struct student
{
char name[30],department[50];
int age;
}
s[l0];
void main()
{
FILE *ptr;
clrscr();
ptr=fopen("employee.dat","r");
printf("\n Name \t Department \t Marks");
while(fscanf(ptr,"\n%s\t%s\%d",s[i].name,s[i].department,&s[i]_age)!=EOF)
{
printf("\n%s\t%s\t%d",s[i].name,s[i].department,S[i]_age);
}
fclose(ptr);
qetch();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment