1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include <stdlib.h>
#include <stdio.h>
int main()
{
char name[50];
int weight,height,age;
char tab[100];
;
int i;
FILE *file;
file = fopen("student.txt","w");
scanf("%s",&name);
scanf("%d",&weight);
scanf("%d",&height);
scanf("%d",&age);
fprintf(file,";%s %s %d %d %d",name,weight,height,age);
fclose(file);
file = fopen("student.txt","r");
while(tab!=EOF)
{
fgets(file,"%s",tab);
printf("%s",tab);
}
fclose(file);
return 0;
}
|