Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include<stdlib.h>
- #define flush while((getchar()) != '\n')
- struct sinhvien
- {
- char name[100];
- int nums;
- float p[3];
- };
- int count()
- {
- FILE *quanly =fopen()
- int c = 0; int temp = fgetc(quanly);
- while (temp != EOF)
- {
- c++;
- fseek(quanly, sizeof(struct sinhvien)*c, SEEK_SET);
- }
- fclose(quanly);
- return c;
- }
- void add(int n)
- {
- int c = count();
- for (int i = 1; i <= n; i++)
- {
- struct sinhvien sv;
- sv.nums = i + c;
- flush;
- gets(sv.name);
- for(int i=0;i<n;i++)
- {
- scanf("%f", &sv.p[i]);
- fseek(quanly, 0, SEEK_END);
- fwrite(&sv, sizeof(sv), 1, quanly);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement