C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
Question
Book Icon
Chapter 6, Problem 11SA
Program Plan Intro

Program Plan:

  1. Define the function isWhitespace, which takes a single character as input and returns a Boolean value indicating whether the character is a whitespace character or not.
  2. Within the isWhitespace function, use a series of conditional statements to check if the character is equal to any of the whitespace characters: space (' '), tab ('\t'), newline ('\n'), carriage return ('\r'), form feed ('\f'), or vertical tab ('\v').
  3. If the character is equal to any of the whitespace characters, return true; otherwise, return false.
  4. Define the main function.
  5. Within the main function, declare several character variables, and assign them different characters including whitespace and non-whitespace characters.
  6. Pass each of these character variables to the isWhitespace function to test whether they are whitespace characters or not.
  7. Print the results of each test using std::cout.

Program Description:

To define a function that can be used to determine whether a given character is a whitespace character or not.

Blurred answer
Students have asked these similar questions
Programming Language : R programming (R Studio) A twin prime is a prime that has a prime gap of two. Sometimes the term twin prime isused for a pair of twin primes. For example, the five twin prime pairs are (3, 5), (5, 7),(11, 13), (17, 19) and (29, 31). Write a function that returns the number of all twin primepairs between 1 and a given number n.
integer) Write a function that computes the sum of the digits in an integer. Use the following function header:def sumDigits(n):For example, sumDigits(234) returns 9 (Hint: Use the % operator to extract digits, and the // operator to remove the extracted digit. For instance, toextract 4 from 234, use 234 % 10 To remove 4 from 234, use 234 // 10 (=23) Use a loop to repeatedly extract and remove the digits until all the digits are extracted.) Write a test program that prompts the user to enter an integer and displays the sum of all its digits.
Under what circumstances can you successfully return a pointer from a function?
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning