Commit de5a051d by raliis

Upload New File

parent 31928528
Showing with 61 additions and 0 deletions
#include <stdio.h>
#include <string.h>
typedef struct Andmed
{
char eesnimi[30];
char perenimi[30];
char matrikkel[30];
char aineNimi[30];
char aineKood[30];
int tulemus;
}Andmed;
void output ();
int main ()
{
FILE *tudengid, *ained, *eksamileht;
Andmed Data;
Andmed Tudengid[25];
Andmed Ained[25];
int i = 0;
tudengid = fopen("tudengid.txt", "r"); // avab failid lugemiseks
ained = fopen("ained.txt", "r");
// scanib sisse tudengi nime ja matriklinumbri
while(fscanf(tudengid, "%s %s %s", Data.eesnimi, Data.perenimi, Data.matrikkel) != EOF)
{
printf("%s, %s, %s \n", Data.eesnimi, Data.perenimi, Data.matrikkel);
Tudengid[i] = Data;
i++;
}
i = 0;
// scanib sisse aine nime, aine koodi, tudnegi matriklinumbri ja selle tudengi tulemuse
while(fscanf(ained, "%s %s %s %d", Data.aineNimi, Data.aineKood, Data.matrikkel, &Data.tulemus) != EOF)
{
printf("%s, %s, %s, %d \n", Data.aineNimi, Data.aineKood, Data.matrikkel, Data.tulemus);
Ained[i] = Data;
i++;
}
i = 0;
return 0;
}
void output ()
{
FILE *eksamileht;
eksamileht = fopen ("Pilet.txt", "w");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment