C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
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.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(True/False): The ReadConsole function reads mouse information from the input buffer
(Difficulty Level 3)Write a function frequency_match(text, chars) that receives a string text and a dictionary chars that has characters as keys and numbers as values. The function must return a list with all the characters that occur in the text as many times as their associated value in the char dictionary.
Not all the chars in the text will be present in the dictionary, but you may assume that all the chars in the dictionary are in the text. You are allowed to change the values in the dictionary.
solve using python
. (True/False): A segment selector points to an entry in a segment descriptor table
Chapter 21 Solutions
C How to Program (8th Edition)
Ch. 21 - (Write C++ Statements) Write a statement for each...Ch. 21 - (Inputting Decimal, Octal and Hexadecimal Values)...Ch. 21 - Prob. 21.8ECh. 21 - Prob. 21.9ECh. 21 - Prob. 21.10ECh. 21 - Prob. 21.11ECh. 21 - (Converting Fahrenheit to Celsius) Write a program...Ch. 21 - In some programming languages, strings are entered...Ch. 21 - Prob. 21.14ECh. 21 - Prob. 21.15E
Knowledge Booster
Similar questions
- (ABET 2) Construct a regular expression corresponding to the following set: {binary strings such that every odd position is a 1}. You may assume that the even positions can be a 0 or 1.arrow_forward(Count the letters in a string) Write a function that counts the number of letters in a string using the following header: def countLetters(s) : Write a test program that prompts the user to enter a string and displays the number of letters in the string. the answer should be in python.arrow_forward(Replace strings) Write the following function that replaces the occurrence of a substring old_substring with a new substring new_substring in the string s. The function returns true if string s is changed, and otherwise, it returns false. bool replace_strings (string& s, const string& old_string, const string& new_string) Write a test program that prompts the user to enter three strings, i.e., s, old string, and new_string, and display the replaced string.arrow_forward
- Modified Programming ). (Count vowels and consonants, file input, nested-loops, switch statement) Assume that letters A, E, I, O and U are the vowels. Write a program that reads strings from a text file, one line at a time, using a while-loop. You do the following operations within each loop: • Read one line from the input file and store it in a string; Count the number of vowels and consonants (using either while-loop or for-loop) in the file string. The while-loop will terminate when the end-of-file is reached. After the loop is finished, the program displays the total number of vowels and consonants in the text file. [A text file, named “ass4_Q6_input.txt", is provided as your testing input file.]arrow_forward(ABET 2) Construct a regular expression corresponding to the following set: {binary strings that start with 0 and have even length, or start with 1 and have odd length}.arrow_forward(java programming language) Write a program to read and store four student’s 21SP registered course and their grade point, sortthem into an order their 21SP registered course, based on grade point from the smallest to the largest,then print them out. The student’s 21SP registered course and their grade point values should be typedin by the user in response to a prompt message. Save the file as SortCourse_yourID.javaarrow_forward
- (Duplicate Elimination) Write a program that reads in a series of first names and eliminates duplicates by storing them in a Set. Allow the user to search for a first name. Add a name to set, use end to terminate input: Search a name, use end to terminate searching: Sample output as follows:arrow_forward(Display patterns using loops) Use nested loops that display the following patterns in two separateprograms: pattern A Pattern B Pattern c 123456 1 3 1 6 1 2 3 3 3 1 6 1 2 3 4 5 3 3 3 1 6 1 2 3 4 5 6 7 3 3 1 6 1 2 3 4 5 6 7 8 9 3 123456arrow_forward(Class Average: Writing a Gradebook Dictionary to a JSON File) Reimplement Exercise 9.3 using the json module to write the student information to the file in JSON format. For this exercise, create a dictionary of student data in the following format: gradebook_dict = {'students': [student1dictionary, student2dictionary, ...]} Each dictionary in the list represents one student and contains the keys 'first_name', 'last_name', 'exam1', 'exam2' and 'exam3', which map to the values representing each student’s first name (string), last name (string) and three exam scores (integers). Output the gradebook_dict in JSON format to the file grades.json.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning