There's a similar question to this below me, but I thought it would be easier to answer if there was an example to refer to.
Code:
#include<stdio.h>
int main () {
int choice, opens, saves, news;
printf("What would you like to do?\n");
printf("\t1 - Open\n");
printf("\t2 - Save\n");
printf("\t3 - New\n");
printf("\t4 - Display selections\n");
scanf("%d", &choice);
while (choice != 4){
switch(choice) {
case 1:
printf("Opening..");
break;
case 2:
printf("Saving..");
break;
case 3:
printf("Creating new..");
break;
case 4:
break;
default:
printf("Invalid Input.");
break;
} //switch close
printf("What would you like to do?\n");
printf("\t1 - Open\n");
printf("\t2 - Save\n");
printf("\t3 - New\n");
printf("\t4 - Display selections\n");
scanf("%d", &choice);
} //while close
printf(" %d opens, %d saves, %d new files", opens, saves, news);
return 0;
}
So what would I have to add in order for this code to display how many times the user has selected open, save or new? I'd really appreciate the help.