Algorithm
step1: display 3 choices
step2: user inputs one choice
step3: Choice is store in one variable
step4: selected choice is transfered to switch function
step5: choice is compare to cases
step6: a text document is created stating you choice.
This is layout of the code:
#include<stdio.h>
void main()
{
char chois;
printf("Enter your choise");
scanf("%c",&chois);
switch(chois)
{
case 1:
FILE *fp;
fp=fopen("file1.txt","w");
fprintf(fp,"%s","You choosed 1");
fclose(fp);
case 2:
FILE *fp;
fp=fopen("file2.txt","w");
fprintf(fp,"%s","You choose 2");
fclose(fp);
break;
case 3:
FILE *fp;
fp=fopen("file3.txt","w");
fprintf(fp,"%s","You choose 3");
fclose(fp);
break;
default:
FILE *fp;
fp=fopen("file4.txt","w");
fprintf(fp,"%s","Invalid CHooise");
fclose(fp);
break;
}
}