
Concept explainers
IN C++ PLEASE:
Refer to the sample code provided and output for how the application will run.
Program Description and Functionality: Provide the following in your source file:
1. Comments at the top of your .cpp file.
2. Write the function definitions for the following five function prototypes shown in Listing-1 that are
called from main. Write the function definitions below main starting at the comment shown in
Listing-2
Listing 1: prototypes
// function 1: reads 25 category names into the cat array
void get_category ( std :: string cat [ CATEGORIES ]);
// function 2: gets 25 values for each category
void get_values ( double values [ CATEGORIES ] , std :: string cat [ CATEGORIES ]);
// function 3: computes the total value and stores in total
void compute_total ( double & total , double values [ CATEGORIES ]);
// function 4: computes the longest category name and stores in longest
void get_longest_category_name (int & longest , std :: string cat [ CATEGORIES ]);
// function 5: prints to std : cout the 25 category bar chart
void create_bar_chart ( std :: string cat [ CATEGORIES ] , \
double values [ CATEGORIES ] , int lcl , double total );
Listing 2: main
# include <iostream >
# include <string >
# define CATEGORIES 25
// Prototypes go here
int main (){ // main is shown complete , DO NOT MODIFY
std :: string categories [ CATEGORIES ];
double values [ CATEGORIES ]; double total { 0.0 }; int lcl { 0 };
while ( true ) {
get_category ( categories );
get_values ( values , categories );
compute_total ( total , values );
get_longest_category_name ( lcl , categories );
std :: cout << "\ nCategories as a Percentage of \
the Total ( category_amount /" << total << ")\n";
std :: cout << " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
~~~~~~~~~~~~~~~~~~~~~~~~~~~\ n";
create_bar_chart ( categories , values , lcl , total );
std :: cout << "\ nEnter y to create another bar chart , \
or any other key to exit : ";
std :: string response ; std :: cin >> response ; std :: cout <<"\n";
if ( response != "y")
break ;
lcl = 0; total = 0.0;
}// while
}// main
// Implementations below main
Example usage:
>A03.exe
Enter in the category names for your twentyfive-bar bar chart:
Red Green Orange Yellow Blue
How many in the Red category? 10
How many in the Green category? 20
How many in the Orange category? 30
How many in the Yellow category? 5
How many in the Blue category? 35
Categories as a Percentage of the Total (category_amount/100)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Red **********10.00
Green ********************20.00
Orange ******************************30.00
Yellow *****5.00
Blue ***********************************35.00
Enter y to create another bar chart, or any other key to exit: y
Enter in the category names for your twentyfive-bar bar chart:
Eight Fifty-Five Nineteen One-Hundred 2
How many in the Eight category? 150
How many in the Fifty-Five category? 200
How many in the Nineteen category? 350
How many in the One-Hundred category? 175
How many in the 2 category? 50
IN C++ PLEASE

Step by stepSolved in 3 steps with 3 images

- Consider a message M which is to be encrypted with RSA algorithm.Describe the steps in the encryption and decryption algorithms, including an explanation of the symbols and terms used paying particular attention to the keys employed in encryption and decryption and the size of the message?arrow_forwardInstructions: For each Exercise below, write your code in an IDE and run your code within the IDE as well. Once you have satisfied the Exercise requirements, paste your code below under the corresponding Exercise. Exercise 1: Please perform in C++ Write a program using a function which will accept two integers as an argument and return sum. Call this function from the main function and print the results in the main function! This is a nice and easy warm up to functions! ● ●arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





