c - Where to go from here when manipulating files -


#include <stdio.h> #include <stdlib.h> #include <math.h>  struct student {     int stdntnum[8];     float homework;     float lab;     float midterm;     float finalgrade;     float overall; };  int main() {     file *fileptr, *file2ptr;     char headers[30];     int string[100];      fileptr = fopen("lab5_inputfile.txt", "r");     file2ptr = fopen("lab5_outputfile.txt", "w");     fgets(headers, 30, fileptr);     printf("%s", headers);     fprintf(file2ptr, "%s\toverall grade\n", headers);     fclose(fileptr);     fclose(file2ptr); } 

hey guys,my assignment manipulate example of file shown here:

id          homework    lab     midterm  final  1016807     89.0        93.0    78.0     50.0  1211272     84.0        78.0    23.0     59.0 

i've gotten headings read , write on new file, i'm unsure how approach second part. need change first few numbers of id column x [e.g: xxx6807], use following grades calculate overall grade , have column print new text well. appreciated, thanks! (i've gotten overall column print, let me know if there's more effective way.)

id      homework    lab     midterm  final  overall  1016807 89.0        93.0    78.0     50.0   70.9  1211272 84.0        78.0    23.0     59.0   59.26 

just example of output file should produce, assistance on next approach should , why (in layman's terms possible) help!! [the grade weights 10%, 20%, 30%, , 40% respectively]


Popular posts from this blog