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
What is the best Describe an integer data type
kolbaska11 [484]

Answer:

It is a data type that only holds whole numbers, a.k.a. integers.

what is the picture about?

3 0
2 years ago
What kind of image does this photograph represent?
Drupady [299]
C architecture photograph
8 0
2 years ago
Read 2 more answers
Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is neede
Anastasy [175]

Answer:

Swap daemon

Explanation:

Swap daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is needed. The main function of the swap daemon is to monitor processes running on a computer to determine whether or not it requires to be swapped.

The physical memory of a computer system is known as random access memory (RAM).

A random access memory (RAM) can be defined as the internal hardware memory which allows data to be read and written (changed) in a computer.Basically, a random access memory (RAM) is used for temporarily storing data such as software programs, operating system (OS),machine code and working data (data in current use) so that they are easily and rapidly accessible to the central processing unit (CPU).

Additionally, RAM is a volatile memory because any data stored in it would be lost or erased once the computer is turned off. Thus, it can only retain data while the computer is turned on and as such is considered to be a short-term memory.

There are two (2) main types of random access memory (RAM) and these are;

1. Static Random Access Memory (SRAM).

2. Dynamic Random Access Memory (DRAM).

6 0
3 years ago
Match the following:
Bogdan [553]

Answer:

  1. Operating System.
  2. Laptop.
  3. Convertible computer.
  4. Peripheral.
  5. Desktop Computer.

Explanation:

Operating system is a software that manages the hardware and the software in the system and provides the interface between machine and the user.

Laptops are the portable computing devices which you can carry with you.

Convertible computer have a keyboard that is detachable and can be converted into a tablet.

Peripherals are devices which we can attach to the computer.

Desktop computer is a computing device that not portable at all.

3 0
2 years ago
What name is used to denote a common field that exists between two tables, but is also the primary key for one of the tables??"
Diano4ka-milaya [45]

Answer:

b. foreign key

Explanation:

In the database world, a foreign key is a field on one table and a primary key for another table. The purpose of a foreign key is to provide linkages between two or more tables. Given two tables A and B, and making A the point of reference, a primary key is a field that is unique in A while a foreign key is unique in B.

On another hand, a composite primary key is a combination of two or more fields/columns on database table that can be used to uniquely identify each row in the table.

In the database lingua, what we have is a unique key not a distinct key, though the two words are similar in meaning.

A duplicate key is used when an information may be repeatedly entered on a table.

So the correct option is a foreign key.

4 0
3 years ago
Other questions:
  • Knowledge flows from the information that has been generated. Which of the following does not necessarily flow from information
    15·1 answer
  • In the process of benchmarking for a variable expense (such as payroll) the typical metrics used are "Total Dollars" and "Dollar
    8·1 answer
  • You want to create a hyperlink within your document to the sec web site. which type of link do you create?
    9·1 answer
  • Do you need to know javascript to learn python?
    8·1 answer
  • PLS ANSWER ASAP!
    9·1 answer
  • A computer essentially takes input, processes it, and produces output. Which person developed a machine in the mid-1880s that ac
    6·1 answer
  • Running the Disk Cleanup utility is a quick way to ________. Group of answer choices defrag your hard drive remove spyware progr
    10·1 answer
  • Would you consider upgrading Maxine’s wardrobe a need or a want?
    11·1 answer
  • Which of these lights is NOT part of the standard three-point lighting setup?
    5·1 answer
  • Answer quickly!!!
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!