C How To Program, Global Edition
C How To Program, Global Edition
8th Edition
ISBN: 9781292110974
Author: Paul Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 21, Problem 21.18E
Program Plan Intro

Program Plan:

  • Include necessary header files.
  • Start “main()” function.
    • Declare two arrays to get input.
    • Use getline() function to get input in array “ a ”, with delimiter being ‘c’.
    • Use peek function to display next character in the input stream.
    • Use get() function to get input in array “ b ”, with delimiter being ‘c’.
    • Use peek function to display next character in the input stream.
    • Display both the strings entered.
    • Use strlen() function to calculate the length of input, add one to it and check if it is a null character. It will tell that if the string ends with null character or not.
  • Return an exit the program

Program Description:

The followingprogram checksfunctionality of getline() and get() function.

Blurred answer
Students have asked these similar questions
Write a program that reads a list of integers from input and determines if the list is a palindrome (values are identical from first to last and last to first). The input begins with an integer indicating the length of the list that follows. Assume the list will contain a maximum of 20 integers. Output "yes" if the list is a palindrome and "no" otherwise. The output ends with a newline. Hints:   - use a for loop to populate the array based on the specified size (the first number entered)              - use a for loop to check first value with last value, second value with second from end, etc.              - if the values do not match, set a Boolean variable to flag which statement to output (yes or no)   Ex: If the input is (remember to include spaces between the numbers): 6 1 5 9 9 5 1 the output is: yes Ex: If the input is: 5 1 2 3 4 5 the output is: C++ coding
Design and draw a high-level "as-is" process diagram that illustrates a current process related to a product or service offered through the SSDCI.gov database.
Compare last-mile connections for connecting homes and businesses to the Internet