Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct ball
- {
- char name[50];
- int number;
- int time;
- };
- void fill_table(struct ball *bl,int *p);
- void show_table(struct ball *bl,int size);
- int main ()
- {
- struct ball bl[1000];
- int size;
- int *p;
- size=0;
- p=&size;
- fill_table(bl,&size);
- show_table(bl,size);
- return 0;
- }
- void fill_table(struct ball *bl,int *p)
- {
- int i,x;
- FILE *fp;
- fp=fopen("player.txt","w");
- printf("dwse 1 gia stxia alliws -1 na men se pari kanenas poutsos");
- scanf("%d",&x);
- if (x==1)
- {
- for (i=0; i<1000; i++)
- {
- printf("dwse onoma paiktarou");
- scanf("%s",bl[i].name);
- printf("dwse arithmo paiktarou");
- scanf("%d",&bl[i].number);
- printf("dwse xrono paiktarou");
- scanf("%d",&bl[i].time);
- *p=*p+1;
- fprintf(fp,"onoma %s arithmos %d xronos %d/n",bl[i].name,bl[i].number,bl[i].time);
- fclose(fp);
- printf("dwse 1 gia stxia alliws -1 na men se pari kanenas poutsos");
- scanf("%d",&x);
- if (x==-1)
- break;
- }
- }
- }
- void show_table(struct ball *bl,int size)
- {
- int i;
- for (i=0; i<size; i++)
- {
- printf("\n");
- printf("onoma %s arithmos %d xronos %d\n",bl[i].name,bl[i].number,bl[i].time);
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement