Upload Code
loading-left
loading loading loading
loading-right

Loading

Profile
No self-introduction
codes (1)
In the records.txt student information is stored i
no vote
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 60 struct STUDENTS { int id; char name[9]; double height; }; char *fgetline(FILE *fp, char *str, int n, char delim); int getRecs(char *filename, struct STUDENTS *s, int n); void Sort(struct STUDENTS *s, int n); void Display(struct STUDENTS *s, int n); int main() { struct STUDENTS stud[N]; int n; n = getRecs("E:\Code\hehehe.txt", stud, N); printf("original n=%dn", n); Display(stud, n); Sort(stud, n); Printf ("n the result data (n=%d), n", n); Display(stud, n); return 0; } char *fgetline(FILE *fp, char *str, int n, char delim) { int i; for(i=0; i<n && !feof(fp); i++) { str[i] = fgetc(fp); if(str[i] == delim) break;
pcl508824
2016-08-23
0
1
No more~