Concept explainers
Explanation of Solution
“cctype” header file:
The “cctype” header file is used to declare a set of function to categorize the individual characters in C++. The functions in that header file test a single character argument and return either true or false.
The “isalpha” and “isdigit” functions must need “cctype” header file for testing the character argument.
isalpha – check the given letter is alphabet or not
isdigit – check the given letter is digit or not.
isalpha:
If the argument is the letter either uppercase or lowercase, it return true otherwise it return false.
Example:
Consider the example of “isalpha” is as follows:
//declare and initialize the value to the variable
char c = 'a';
//check the condition
if (isalpha (c))
{
//display the output
cout << "This is a letter";
}
Here, the “c” variable holds the value of “a”. The above “if” condition is used to check if the variable “c” is an alphabet by using “isalpha” character function.
isdigit:
If the argument is a digit, it return true otherwise it return false.
Example:
Consider the example of “isdigit” is as follows:
//declare and initialize the value to the variable
char c = '0';
//check the condition
if ( isdigit (c))
{
//display the output
cout << "This is a digit";
}
Here, the “c” variable holds the value of “0”. The above “if” condition is used to check if the variable “c” is a digit by using “isdigit” character function.
Therefore, the “cctype” header file is used to test a single character argument for “isalpha” and “isdigit” function.
Want to see more full solutions like this?
Chapter 10 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
- Create an C++ array of string type using "My dream job is to be a programmer" in sentence form with the application or integration of the following functions or tools:- Character manipulation tools “getline” and “put”- C-String concatenate- Character manipulation tool “isupper”arrow_forwardCreate a C++ Codearrow_forwardC++ Program using functionsarrow_forward
- Please do in C++ coding please Nrite a program to fulfill the following requirements: You need a program to help you plan a garden. The user will enter - The square footage of their garden plot - Their needs for each of several types of plants (you won't know ahead of time how many types). For each plant they will specify the length of the rows, their width, and the number of rows. After each plant is entered, the program is to calculate the square footage used for that plant and display the remaining square footage left in the garden. The program should then ask them if they want to plant something else. If the user tries to enter too much for a plant compared to what is left, the program should tell them of their error and tell them the square footage that will actually be used for that plant. The user is not required to fill their garden space. When the user is done entering plants, the program should display the total square footage used, the number of plant types and the amount of…arrow_forwardCode using c++ 3. From Person to People by CodeChum Admin Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people! Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons. Your task is to ask the user for the values of the age and gender of these Persons. Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one. Input 1. A series of ages and genders of the 5 Persons Output Person·#1 Enter·Person's·age:·24 Enter·Person's·gender:·M Person·#2 Enter·Person's·age:·21 Enter·Person's·gender:·F Person·#3 Enter·Person's·age:·22 Enter·Person's·gender:·F Person·#4…arrow_forwardoperators are overloaded when there are too many variables in the function.arrow_forward
- C++ Languagearrow_forwardCreate a function called reverse() that has a string parameter. The function reverses the characters of the string locally. ( in C language)arrow_forwardC program it is given that an integer is considered a special integer if the digit cannot be rearranged in a way to produce an integer larger than *431 is a special integer as no other combination of digit would produce and integer that is larger than 431 *312 is not a special in teacher as you could manage the digits as 321 which would be larger than three 12 *any single digit integers such as 5 is always a special integerarrow_forward
- in c++ void check_palindrome() - to check whether the given number by user is palindrome or not. write a program using above function to check whether the number is palindrome or not. please add comments also.arrow_forwardTo utilise the string manipulation functions, which header file must be included in C++ code?arrow_forwardWhich header file must be included for string manipulation functions to be accessible in a C++ application?arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr