Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ General requirements: - No global variables - No multiple return statements in one function - Show how you have tested these functions - cin

C++

General requirements: - No global variables - No multiple return statements in one function - Show how you have tested these functions - cin and cout are not allowed in these function. They can only be in main() or testing functions. It should return the values to the caller through the use of return type and pass-by-reference parameters. - Please do not use struct, tuple or pair class. Please use only pass-by-reference parameters and return type to return values to the caller. - Please do not use string class - Please do not change or sort the array Note: this is an exercise to use functions, arrays and C-string which is an array of characters with NULL terminated character.

Question #2: Write a function named "isAcceptableVariableName" that takes an array of characters terminating by NULL character (C-string). It will go through the array and return whether it is an acceptable variable name or not. It is acceptable if - it does not start with a digit - it only contains alphabet (uppercase or lowercase) or digit In addition, it also returns the number of uppercase and lowercase in that C-string.

For example, if the array is {'H', 'e', 'l', 'l', 'o', '\0'}, it will return true (valid), 1 (uppercase), 4 (lowercase) If the array is {'H', 'e', ' ', 'l', '\0'}, it will return false (invalid), 1 (uppercase), 2 (lowercase) If the array is {'\0'}, it returns false (invalid), 0 (uppercase) and 0 (lowercase). If the array is {'1', 'H', '\0'}, it returns false (invalid), 1 (uppercase) and 0 (lowercase). If the array is {'H', '1', '\0'}, it returns true (valid), 1 (uppercase) and 0 (lowercase). If the array is {'h', '1', '\0'}, it returns true (valid), 0 (uppercase) and 1 (lowercase).

Note: please do not pass in the size of the array as this is a C-string.

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

Step: 3

blur-text-image

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

Big Data 29th British National Conference On Databases Bncod 2013 Oxford Uk July 2013 Proceedings Lncs 7968

Authors: Dan Olteanu ,Georg Gottlob ,Christian Schallhart

2013th Edition

3642394663, 978-3642394669

More Books

Students also viewed these Databases questions