/* students evaluation records using structures */
# include<stdio.h>
# include<conio.h> main()
{
int choice; struct stud { int rollno; int subcode; int marks;
} studeval; FILE *f1;
clrscr();
f1=fopen("eval.dat","w"); while(1)
{
printf("Enter student roll no :"); scanf("%d",&studeval.rollno); printf("\nEnter subject code :"); scanf("%d", &studeval.subcode); printf("\nEnter marks obtained :"); scanf("%d", &studeval.marks);
fprintf(f1,"%d|%d|%d\n",studeval.rollno,studeval.subcode,studeval.marks); printf("Do
you want to add another record (1 for YES 0 for NO) :"); scanf("%d",&choice);
if(choice==0)
{
fclose(f1); exit(0);
}
}
}
No comments:
Post a Comment