All pastes #2069067 Raw Edit

Something

public text v1 · immutable
#2069067 ·published 2011-05-25 17:45 UTC
rendered paste body
#include<stdio.h>
#include<stdlib.h>
#include<string.h>



typedef struct student
{
	char nume[50];
	char grupa[10];
	float medie;
	int nr_restante;
}student;

void main()
{
	FILE *f1;
    f1=fopen("studentiATM","r");
	struct student x[50];


/*	i=-1;
	while(!(feof))
		fscanf(f1,"%c",&x[++i]);
	s[i]=0;
*/

int i=0;	//for(i=0;i<n;i++)
while(f1)
	{
		fscanf(f1,"%s",&x[i].nume);
		fscanf(f1,"%s",&x[i].grupa);
		fscanf(f1,"%f",&x[i].medie);
		fscanf(f1,"%d",&x[i].nr_restante);
		i++;
     }


		printf("%s %s %f %d",x[i].nume,x[i].grupa,x[i].medie,x[i].nr_restante);

	}