As in the C language to make a choice of action through a case with an exit menu choice of action?

Here's a snippet of when, how to do so displaying a selection menu printf... when choosing 0-1-2-3-4 performed the corresponding action in the case
void Menu()
{
 printf("Select action\n");
 printf("0) Replace the text substring “Robin” (can be in words) for the substring “I am Batman”.\n");
 printf("1) Sort the offers to increase the number of commas in a sentence.\n");
 printf("2) Delete all sentences in which the sum of the digits in the offer is equal to 13.\n");
 printf("3) Display all sentences in which the first word starts with a vowel or digit.\n");
 printf("4) Exit the program.\n");
 int choise;
 if (scanf("%d", &choise) != 1)
{
 choise = -1;
}
 struct string text = InputToText();
 struct strings sentences = TextToSentences(&text);
RemoveDuplicates(&sentences);
 switch (choise) {
 case 0: {
ChangeAllSubstringWithRobin(&sentences);
PrintSentences(&sentences);
break;
}
 case 1: {
SortByCountOfCommasInAscendingOrder(&sentences);
PrintSentences(&sentences);
break;
}
 case 2: {
RemoveSentencesWithSumDigit13(&sentences);
PrintSentences(&sentences);
break;
}
 case 3: {
PrintSentencesWhereTheFirstCharacterisvowelletterordigit(&sentences);
break;
}
default:
 printf("Data is incorrect");
exit(0);
}
}


int main()
{
 setlocale(LC_ALL, "Rus");
Menu();
}
April 3rd 20 at 17:22
1 answer
April 3rd 20 at 17:24
In fact - all you have to do all this in a thread loop (type while) to push. Only consider exit conditions. And like all should be run.

Find more questions by tags C