sba/utils.h
2023-07-11 10:41:05 +08:00

24 lines
566 B
C

int choices_selecter(char * Items[],int items,char * welcome_message ){
int choice = 0;
do{
system("cls");
if ((*welcome_message) !=NULL){
printf("%s",welcome_message)
}
printf("Select An Option:\n");
int i;
for (i=0; i<items;i++){
printf("%d. %s\n",i+1,Items[i]);
}
printf("%d. Exit\n",i+1);
printf(">");
if(choice < 1 || choice > items+1){
printf("Invalid choice...press any key to retry....\n");
fflush(stdin);
getchar();
}
}while(choice < 1 || choice > items+1);
return choice;
}