} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student
Posted: Mon Jun 06, 2022 11:08 am
} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student nodes in the first row fscanf(fp,"%d", &L->count); //The data is read circularly, and the number of cycles is count for (int i = 1; i <= L->count; i++) { //Create a new node studentNode* s= (studentNode*)malloc(sizeof(studentNode)); //Read data fscanf(fp,"%s", s->stu.name); fscanf(fp,"%d", &s->stu.number); fscanf(fp,"%d", &s->stu.chinese); fscanf(fp,"%d", &s->stu.math); fscanf(fp,"%d", &s->stu.english); fscanf(fp,"%d", &s->stu.sum); fscanf(fp,"%d", &s->stu.average); //Insert the new node into the tail of the linked list (tail insertion method) s->next = NULL; L->tail->next = S; L->tail = s; } //Close file stream fclose(fp);
} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student nodes in the first row fscanf(fp,"%d", &L->count); //The data is read circularly, and the number of cycles is count for (int i = 1; i <= L->count; i++) { //Create a new node studentNode* s= (studentNode*)malloc(sizeof(studentNode)); //Read data fscanf(fp,"%s", s->stu.name); fscanf(fp,"%d", &s->stu.number); fscanf(fp,"%d", &s->stu.chinese); fscanf(fp,"%d", &s->stu.math); fscanf(fp,"%d", &s->stu.english); fscanf(fp,"%d", &s->stu.sum); fscanf(fp,"%d", &s->stu.average); //Insert the new node into the tail of the linked list (tail insertion method) s->next = NULL; L->tail->next = S; L->tail = s; } //Close file stream fclose(fp);
} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student nodes in the first row fscanf(fp,"%d", &L->count); //The data is read circularly, and the number of cycles is count for (int i = 1; i <= L->count; i++) { //Create a new node studentNode* s= (studentNode*)malloc(sizeof(studentNode)); //Read data fscanf(fp,"%s", s->stu.name); fscanf(fp,"%d", &s->stu.number); fscanf(fp,"%d", &s->stu.chinese); fscanf(fp,"%d", &s->stu.math); fscanf(fp,"%d", &s->stu.english); fscanf(fp,"%d", &s->stu.sum); fscanf(fp,"%d", &s->stu.average); //Insert the new node into the tail of the linked list (tail insertion method) s->next = NULL; L->tail->next = S; L->tail = s; } //Close file stream fclose(fp);
} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student nodes in the first row fscanf(fp,"%d", &L->count); //The data is read circularly, and the number of cycles is count for (int i = 1; i <= L->count; i++) { //Create a new node studentNode* s= (studentNode*)malloc(sizeof(studentNode)); //Read data fscanf(fp,"%s", s->stu.name); fscanf(fp,"%d", &s->stu.number); fscanf(fp,"%d", &s->stu.chinese); fscanf(fp,"%d", &s->stu.math); fscanf(fp,"%d", &s->stu.english); fscanf(fp,"%d", &s->stu.sum); fscanf(fp,"%d", &s->stu.average); //Insert the new node into the tail of the linked list (tail insertion method) s->next = NULL; L->tail->next = S; L->tail = s; } //Close file stream fclose(fp);
} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student nodes in the first row fscanf(fp,"%d", &L->count); //The data is read circularly, and the number of cycles is count for (int i = 1; i <= L->count; i++) { //Create a new node studentNode* s= (studentNode*)malloc(sizeof(studentNode)); //Read data fscanf(fp,"%s", s->stu.name); fscanf(fp,"%d", &s->stu.number); fscanf(fp,"%d", &s->stu.chinese); fscanf(fp,"%d", &s->stu.math); fscanf(fp,"%d", &s->stu.english); fscanf(fp,"%d", &s->stu.sum); fscanf(fp,"%d", &s->stu.average); //Insert the new node into the tail of the linked list (tail insertion method) s->next = NULL; L->tail->next = S; L->tail = s; } //Close file stream fclose(fp);
} if (fp == NULL) { printf("file%s Open failed\n", FILE_NAME); exit(EXIT_FAILURE); } //Read the total number of student nodes in the first row fscanf(fp,"%d", &L->count); //The data is read circularly, and the number of cycles is count for (int i = 1; i <= L->count; i++) { //Create a new node studentNode* s= (studentNode*)malloc(sizeof(studentNode)); //Read data fscanf(fp,"%s", s->stu.name); fscanf(fp,"%d", &s->stu.number); fscanf(fp,"%d", &s->stu.chinese); fscanf(fp,"%d", &s->stu.math); fscanf(fp,"%d", &s->stu.english); fscanf(fp,"%d", &s->stu.sum); fscanf(fp,"%d", &s->stu.average); //Insert the new node into the tail of the linked list (tail insertion method) s->next = NULL; L->tail->next = S; L->tail = s; } //Close file stream fclose(fp);