i am making a program in which it asks the user to calculate depth of the pit. later on the last estimated value needs to be saved into the file.
user selects from the following options:
insert
Code:
printf("\t\t\tMain Menu\n\n");
printf("(D)epth: Enter pit location, Compute depth \n");
printf("(S)ave : Write pits data to file \n");
printf("(L)oad : Read mine shaft information from file.\n");
printf("(P)rint: Display mine shaft information.\n");
printf("(Q)uit : Exit program.\n");
printf("Enter choice(D/S/L/P/Q)\n\n");
scanf("%c",&choice);
fflush(stdin);
switch (choice)
{
i have solved the first part
insert
Code:
case 'd': case 'D':
do
{ for (i=0; i<1; i++)
{ printf("Enter the mine shaft location or name:\n");
fgets(location, 100, stdin);
}
printf("\nEnter time in seconds to bottom: \n");
scanf("%lf", &toBottom);
fflush(stdin);
printf("\nShaft depth is %.2f m\n", depth(toBottom) );
} while( yesNo("Do you want to take another measure"));
now the last estimated depth needs to get stored in the file for that i need to create array for depth. how should i get the dta into the array?