Professional Documents
Culture Documents
Writing To Files Using Loops
Writing To Files Using Loops
h>
#include <windows.h>
FILE *trial;
int main(void)
int choice,account;
char name[20];
float balance;
if ((trial=fopen("comsci.txt","a"))==NULL)
else
printf("Enter account\n");
scanf("%d",&account);
scanf("%s",name);
scanf("%d",&choice);
while(choice == 1)
system("cls");
printf("Enter account\n");
scanf("%d",&account);
scanf("%s",name);
scanf("%4f", &balance);
fprintf(trial,"%d %s %.2f\n",account,name,
balance);
printf("\nEnter Choice[yes-1/No-2]:\n");
scanf("%d",&choice);
}
}
fclose(trial);