Answer:
Function contains into the code asked for:
- Receives a string as an argument.
- count the number of vowels in the string and return that number.
- receives a string as an argument.
- count the number of consonants in the string and return that number.
Step-by-step explanation:
//Let's call libraries
#include <stdio.h>
#include <conio.h>
//Start main
int main()
{
//*Declare functions for counting number of vowels and consonants
int vowels=0;
int consonants=0;
int all=0;
//Output need information
//Ask user to input a string
printf("what do you want to count?\\");
printf("1-the vowels.\\");
printf("2-the consonants.\\");
printf("3-all of the letters on a phrase.\\");
printf("\\");
printf("-> ");
int a;
a = getchar();
switch (a)
{
//Ask user what function they want to run
case '1':
//Call the function needed to count the vowels
printf("Introduce a phrase: ");
char textoa[1001];
scanf("%s", &textoa);
char *p;
p = textoa;
while (*p != '\0')
*p == 'A'
printf("there are %d vowels.", vowels);
break;
case '2':
//Call the function needed to count the consonants
printf("Introduce a phrase: ");
char textob[1001];
scanf("%s", &textob);
p = textob;
while (*p != '\0')
printf("there are %d consonants.", consonants);
break;
case '3':
printf("Introduce a phrase: ");
char textoc[1001];
scanf("%s",&textoc);
p = textoc;
while (*p != '\0')
if (*p == 'a'
printf("there are %d letters on the phrase.", all); break;
} getch();
}