Program to create Simple Structure



#include
main( )
{
struct {
char name [20] ;
int age ;
int test ;
int run ;
} play ;

FILE *p ;
char ch =’y’;
p =fopen ("rec.dat", "w") ;
while (ch = =’y’)
{
printf ("Name") ;
scanf("%s", play.name) ;
printf ("Age") ;
scanf("%d, &play.age) ;
printf ("Number of test played”) ;
scanf("%d", &play.test) ;
printf ("Total run") ;
scanf("%d", &play.run) ;
fprintf(p, "%s%d%d%d",play.name, play.age, play.test, play.run) ;
printf ("More ? :") ;
scanf("%c", &ch);
}
fclose(p) ;
}




No comments:

Post a Comment