
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
In c++ please.
![**11.6 (Occurrences of each digit in a string) Write a function that counts the occurrences of
each digit in a string using the following header:
int count (const string& s)
The function counts how many times a digit appears in the string. The return value is an
array of ten elements, each of which holds the count for a digit. For example, after
executing int* counts = count("12203AB3"), counts[0] is 1, counts[1]
is 1, counts [2] is 2, counts [3] is 2.
Write a main function to display the count for "SSN is 343 32 4545 and ID is
434 34 4323".
Redesign the function to pass the counts array in a parameter as follows:
void count (const string& s, int counts[], int size)
where size is the size of the counts array. In this case, it is 10.](https://content.bartleby.com/qna-images/question/50f86a9a-dfbf-48fb-a8b1-f37eac08df1e/05ce6471-d0a0-4cf6-92f1-e1fda54bb279/2g61brs_thumbnail.png)
Transcribed Image Text:**11.6 (Occurrences of each digit in a string) Write a function that counts the occurrences of
each digit in a string using the following header:
int count (const string& s)
The function counts how many times a digit appears in the string. The return value is an
array of ten elements, each of which holds the count for a digit. For example, after
executing int* counts = count("12203AB3"), counts[0] is 1, counts[1]
is 1, counts [2] is 2, counts [3] is 2.
Write a main function to display the count for "SSN is 343 32 4545 and ID is
434 34 4323".
Redesign the function to pass the counts array in a parameter as follows:
void count (const string& s, int counts[], int size)
where size is the size of the counts array. In this case, it is 10.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In C++ Even if a problem does not directly tell you to use a function, you should aim to do so regardless. 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?arrow_forwardanswer only in c++arrow_forwardC++ Can a variable name be passed to a value parameter in C++ functions?arrow_forward
- To use a predefined function in your C++ program, you have to include its prototype? True or falsearrow_forwardin C++ Write the definition of a value-returning function that accepts two integer parameters and returns the larger one divided by the smaller one.arrow_forwardIn C++, Every function has four elements. For example, one element is the function name. List the other elements.arrow_forward
- Destructor, copy constructor and operator= are special functions provided by C++. Group of answer choices True Falsearrow_forwardHello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify the error and fix it? #include<iostream>#include<cstring> // for string class functions#include<fstream>#include <cctype>using namespace std; int main(){// define variable to get the response from user "Yes" or "No"string response;// Define index variableint w = 0;// define number of words that need to be guessed by the user assume 4const int WORDS = 4;// loopdo{// we will define the hangman bodyconst char body[] = "o/|\\|\\";// here we define the wordsstring words[WORDS] = {"MACAW", "SADDLE", "TOASTER", "XENOICIDE"};// fetch size or lengthstring xword(words[w].length(),'*');// define iterator to fetch the wordsstring::iterator i, ix = xword.begin();// define number of words to prompt for the userchar letters[26]={"\0"};// Now we define the variables which will be used in the simulationint n =0, xcount = xword.length();bool found = false, solved = false, hung =…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education