Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 - String Operations - 4 0 pointsDr. Bizzarus is on a mission. He is approaching people on the street and asking them to

Problem 1- String Operations -40 pointsDr. Bizzarus is on a mission. He is approaching people on the street and asking them to write a sentenceof their choice on a notepad. He is then going to generate statistics on the string. He wants to know theway they volunteers space out their strings, the number of hexadecimal numeral characters, and thenumber of matched upper and lowercase characters found in the string. However, he is completely out of2
his depth with string processing and has just hired you to write a C++ program for him.This program has to use C++ string objects, and not C-strings.Specifications Call this program stringops.cpp Write a function called spaceCount that takes in a string as a parameter and returns the number ofwhitespace characters in the string. (6 points) Write a function called digitCount that takes in a string as a parameter and returns the number ofhexadecimal numeral characters in the string. (6 points) Write a function called caseMatchCount that takes in a string as a parameter and returns thenumber of matched lower and uppercase characters in the string. Each matched character pair mustbe counted only once. That is, if you have a string HELLO World, you will have 2 matchedcharacters - l and o. The ls should not be counted twice. You will be allowed the use of parallelarrays for this. (13 points) In the main function, accept a # terminated string from the user. Then, print all the 3 statisticsof the string. Repeat until the user enters Done.(10 points) Please comment your code appropriately. (5 points) You are restricted to the iostream, cctype and string libraries for this program. You are not allowed to use the string class iterators like begin, end, rbegin, rend, etc. The text entered may contain stray whitespace.Sample RunRegular text is whats printed by your program. Underlined text is user input, shown here as a sample.You will not be printing the underlined parts in your program.Enter the string: Maybe a story will cheer you up.Once upon a time there was an UglyBarnacle. He was so ugly, that everyone died.the end.#Number of whitespace charcaters: 31Number of hexadecimal digits: 32Number of matched characters: 5Enter the string: Who are you 50 people?!!#Number of whitespace characters: 4Number of hexadecimal digits: 6Number of matched characters: 0Enter the string: Done#

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions