Proba 2
Never
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char name[50]; char surname[50]; char namesubject[50]; int year; int grade; }Student; int countpasses(Student x) { if (x.grade>5) { return 1; } return 0; } float aavg(Student x, int year, float *counter) { float comeback; if (x.year==year) { (*counter)++; comeback = x.grade; return comeback; } return 0; } int main(void) { FILE *in, *out; in = fopen("ulaz.txt", "r"); out = fopen("izlaz.txt", "w"); Student x[50]; int i = 0, j, year, help, passes = 0; float avg1 = 0, counter1 = 0, avg2 = 0, counter2 = 0; char nameofstudent[50]; printf("Student name: "); gets(nameofstudent); while (1) { fscanf(in, "%s%s%s%d%d", &x[i].name, &x[i].surname, &x[i].namesubject, &x[i].year, &x[i].grade); if (feof(in)) { break; } i++; } for ( j = 0; j < i; j++) { if (strcmp(x[j].name,nameofstudent)==0) { help = countpasses(x[j]); passes += help; } } for (j = 0; j < i; j++) { if (strcmp(x[j].name, nameofstudent)==0) { avg1 += aavg(x[j], 1, &counter1); avg2 += aavg(x[j], 2, &counter2); } } avg1 = avg1 / counter1; avg2 = avg2 / counter2; fprintf(out, "Student je polozio %d predmeta.\nProsek za prvu godinu: %.2f\nProsek za drugu godinu: %.2f\n", passes, avg1, avg2); fclose(in); fclose(out); system("pause"); return 0; }
Raw Text
-
FitSpresso
17 min ago
-
Hot Girl With Hour Glass Figure Makes Her Return
17 min ago
-
Japanese honey Haru Sakuraba got fucked uncensored
50 min ago
-
https://www.facebook.com/TryCareCBDGummies/
1 hour ago
-
Morning Momentum: Starting Your Day Right with FitsPresso
1 hour ago
-
Kimmy Kimm says, "Wow! You filled me with a SuperHero Sized Load inside my pussy, Stepbro!"
1 hour ago
-
Makers CBD Gummies
1 hour ago
-
Adult Telegram Channels
1 hour ago
-
Just chill and fuck at home
1 hour ago
-
Performer 8 Male Enhancement
1 hour ago