#include<stdio.h> #include<conio.h> #include<stdlib.h> #define no 20 struct { int r_no; char name[30]; int m1; }s[no]; void main() { int i; char ch; FILE *fp; clrscr(); fp=fopen("C:Student.dat","r"); printf("\nResult of students:\n"); printf("\nS.No. Rollno Name\t\t\tResult\tPercent"); printf("\n----- ------ ----\t\t\t------\t-------"); fread(s,sizeof(s),no,fp); for(i=0;i<no;i++) { if(s[i].m1>=40) ch='P'; else ch='F'; printf("\n%-4d %-5d %-25s\t%3c\t %.2f%",i+1,s[i].r_no,s[i].name,ch,s[i].m1); } getch(); fclose(fp); }
WHAT'S NEW?
Loading...
0 comments:
Post a Comment