1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xeze [42]
3 years ago
5

Write a function chat accepts a pointer to a C-string as its argument. The function should count the number of vowels appearing

in the sering and rerurn that number. Write another function that accepts a pointer to a C-string as its argument. This function should count the number of consonants appearing in the string and return that number. Demonstrate these two functions in a program rhar performs the following steps: I. The user is asked to enter a string. 2. The program displays the following menu: A) Count the number of vowels in rhe string 8) Count the number of consonants in the string C) Count both the vowels and consonants in the string D) Enter another string E) Exit the program 3. The program performs the operation selected by the user and repeats until the user selects E to exit the program.
Computers and Technology
1 answer:
Dovator [93]3 years ago
8 0

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.  

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?\n");    

printf("1-the vowels.\n");      

printf("2-the consonants.\n");    

printf("3-all of the letters on a phrase.\n");      

printf("\n");      

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')

               {

                     if (*p == 'a' || *p == 'e' || *p == 'i' || *p == 'o' || *p == 'u' || *p == 'A' || *p == 'E' || *p == 'I' || *p == 'O' || *p == 'U') vocales ++;

                     p++;

               }

               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')

               {

                     if (*p == 'b' || *p == 'B' || *p == 'c' || *p == 'C' || *p == 'd' || *p == 'D' || *p == 'f' || *p == 'F' || *p == 'g' || *p == 'G' || *p == 'h' || *p == 'H' || *p == 'j' || *p == 'J' || *p == 'k' || *p == 'K' || *p == 'l' || *p == 'L' || *p == 'm' || *p == 'M' || *p == 'n' || *p == 'N' || *p == 'p' || *p == 'P' || *p == 'q' || *p == 'Q' || *p == 'r' || *p == 'R' || *p == 's' || *p == 'S' || *p == 't' || *p == 'T' || *p == 'v' || *p == 'V' || *p == 'w' || *p == 'W' || *p == 'x' || *p == 'X' || *p == 'y' || *p == 'Y' || *p == 'z' ||  

*p == 'Z') consonants ++;

                     p++;

               }

               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' || *p == 'e' || *p == 'i' || *p == 'o' || *p == 'u' || *p == 'A' || *p == 'E' || *p == 'I' || *p == 'O' || *p == 'U' || *p == 'b' || *p == 'B' || *p == 'c' || *p == 'C' || *p == 'd' || *p == 'D' || *p == 'f' || *p == 'F' || *p == 'g' || *p == 'G' || *p == 'h' || *p == 'H' || *p == 'j' || *p == 'J' || *p == 'k' || *p == 'K' || *p == 'l' || *p == 'L' || *p == 'm' || *p == 'M' || *p == 'n' || *p == 'N' || *p == 'p' || *p == 'P' || *p == 'q' || *p == 'Q' || *p == 'r' || *p == 'R' || *p == 's' || *p == 'S' || *p == 't' || *p == 'T' || *p == 'v' || *p == 'V' || *p == 'w' || *p == 'W' || *p == 'x' || *p == 'X' || *p == 'y' || *p == 'Y' || *p == 'z' || *p == 'Z') all ++;

                     p++;

               }

               printf("there are %d letters on the phrase.", all);                 break;

   }     getch();

}

You might be interested in
When you divide a picture into thirds, how many parts do you end up with? *
lara31 [8.8K]

Answer:

3

Explanation:

6 0
3 years ago
Read 2 more answers
Suppose a company A decides to set up a cloud to deliver Software as a Service to its clients through a remote location. Answer
finlep [7]

Answer:

perdonnosee

Explanation:

8 0
3 years ago
Sql is an example of a ________ category programming language. 4gl 3gl 5gl 2gl
kicyunya [14]
The answer is Fourth-generation language (4GL).  <span>Sql is an example of a 4GL category programming language.  </span>SQL<span> is considered a Fourth-generation </span>language<span> (</span>4GL), whereas Java and C++ are third-generation languages<span> (3GLs). Fourth-generation </span>languages<span> are programming  </span>languages<span> that are closer to human </span>language<span> than the high-level </span>languages<span>  like Java.</span>
8 0
3 years ago
What are the oop concept of java
mash [69]

Answer: OOP concepts in Java are the main ideas behind Java’s Object Oriented Programming. They are abstraction, encapsulation, inheritance, and polymorphism. Grasping them is key to understanding how Java works. Basically, Java OOP concepts let us create working methods and variables, then re-use all or part of them without compromising security.

HOPE THIS HELPED IS NOT SORRY.

4 0
2 years ago
Read 2 more answers
What is Deep learning
vodomira [7]

Answer:

Deep learning is an AI function that mimics the workings of the human brain in processing data for use in detecting objects, recognizing speech, translating languages, and making decisions. Deep learning AI is able to learn without human supervision, drawing from data that is both unstructured and unlabeled.

3 0
3 years ago
Other questions:
  • Digital cameras are less susceptible to UV light.Select one of the options below as your answer:A. TrueB. False
    15·2 answers
  • 80% OF QUESTIONS ARE ANSWERED IN UNDER 10 MINUTES why not mine
    15·2 answers
  • Please help will mark brainiest
    8·1 answer
  • _____ is the software that protects you computer from harmful files, Trojan horses, and worms.
    13·2 answers
  • What is a header row?
    8·1 answer
  • What do you think Amazon should fix?
    13·2 answers
  • Different he launc.<br>in function are available with MS-Excel<br>Many​
    14·1 answer
  • What is the primary cause of the industrial revolution?
    12·1 answer
  • Most of the energy we use originally came from:
    8·1 answer
  • System development life cycle
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!