#include <stdio.h>
int main()
{
int n;
FILE *pf = fopen("1.txt", "w+");
if (!pf)
{
puts("open file error!");
return -1;
}
while (true)
{
printf("input a num:");
scanf("%d", &n);
if (n==-1)
break;
fprintf(pf, "%d ", n);
}
fclose(pf);
puts("ok!");
return 0;
}