rendered paste body#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 128
#define M 3
void get_data_from_user() {
FILE *fp;
char epitheto[N];
char onoma[N];
float grade;
int i;
fp = fopen("eisagwgi.txt", "w");
if (fp == NULL) {
fprintf(stderr, "Error opening file for input.\n");
exit(1);
}
printf("Dwse to epitheto: ");
scanf("%s", epitheto);
while (strcmp(epitheto, "*")) {
fprintf(fp, "%s", epitheto);
printf("Dwse onoma: ");
scanf("%s", onoma);
fprintf(fp, "%s ", onoma);
for (i=0; i<M; i++) {
printf("Dwse thn %di vathmologia: ", i+1);
scanf("%f", &grade);
fprintf(fp, "%f ", grade);
}
fprintf(fp, "\n");
printf("Dwse to epitheto: ");
scanf("%s", epitheto);
}
fclose(fp);
}
int main() {
get_data_from_user();
return 0;
}