#include <stdio.h>
#include <string.h>
struct toys{ char name[20];int cost;} toy;

int main()
{	FILE *f;
    f=fopen("test2.dat","w+b");
    puts("Input toy name,cost or end");
    while(scanf("\n%s",toy.name),
                  strcmp(toy.name,"end")!=0)
     {	 scanf("%d",&toy.cost);
         fwrite(&toy,sizeof(toy),1,f);
     }
    fclose(f);
    return 0;
}
