c - Where to go from here when manipulating files -
c - Where to go from here when manipulating files -
#include <stdio.h> #include <stdlib.h> #include <math.h> struct pupil { 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 illustration 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 sec part. need alter first few numbers of id column x [e.g: xxx6807]
, utilize next grades calculate overall grade , have column print new text well. help appreciated, thanks! (i've gotten overall column print, allow 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 illustration 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]
c arrays string file structure
Comments
Post a Comment