C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
8th Edition
ISBN: 9780134227023
Author: Paul J. Deitel; Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 12.11E
Program Plan Intro
Program plan:
- String, ch, k, flag variables are used for input. There is structure stknode having ch, nextval member variables which represent the stack value.
- void push(stack **top, char alphabet) function inserts the node in the stack.
- char pop(stack **top) function delete the value in the given and returns the delete value.
- char peep(stack *top) function returns the value which exists at the top of the stack.
- void dispalystack(stack *top) function displays the contents of the stack.
Program description:
The main purpose of the program is to create a stack from the input string as a character by character. Then it compares the original string with stack value by ignoring the space and punctuation marks and checks whether input string is palindrome or not.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Expression Conversion
[Problem Description]
Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers.
[Basic Requirements]
You are required to use stack.
The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value.
If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter.
please i need the program in c or c++ and please read the requirement below
Algorithm design: The required data structure is designed, the algorithm idea and algorithm steps are given, and the time complexity of the algorithm is analyzed.
Annotated source code: Paste the source code, preferably annotate the code.…
Expression Conversion
[Problem Description]
Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers.
[Basic Requirements]
You are required to use stack.
The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value.
If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. If the input is
do the code in c++ please
D. If the values of A, B , C and D are 2, 3, 4 and 5 respectively, manually calculate
the value of the following postfix expressions using stack.
a. AB*C-D+
b. ABC +*D-
||
Chapter 12 Solutions
C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
Ch. 12 - Prob. 12.6ECh. 12 - (Merging Ordered Lists) Write a program that...Ch. 12 - Prob. 12.8ECh. 12 - (Creating a Linked List, Then Reversing Its...Ch. 12 - Prob. 12.10ECh. 12 - Prob. 12.11ECh. 12 - Prob. 12.12ECh. 12 - Prob. 12.13ECh. 12 - Prob. 12.14ECh. 12 - (Supermarket Simulation) Write a program that...
Knowledge Booster
Similar questions
- Expression Conversion[Problem Description]Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers.[Basic Requirements]1) You are required to use stack.2) The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value.If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. Please i need the above topic program in C or C++arrow_forward(True/False): When a program’s source code is modified, it must be assembled and linkedagain before it can be executed with the changesarrow_forward3. Use a stack to evaluate the following postfix expression. 3 5 7 + 2 1 * 1 + +arrow_forward
- answer only know else skip sure dislike if copiedarrow_forward7. The following function converts a postfix expression to an infix expression assuming the expression can only contain unsigned integer numbers and +' and -' operators. 1. public static String convert (String postfix) { 2. String operand1, operand2, infix; 3. Stack s = new AStack; 4. int i = 0; 5. while (i < postfix.length) { char nextc = postfix.charAt (i); if ((nextc 6. 7. '+')|| (nextc == '-') { == operand2 = s.pop (); operandl = s.pop () ; infix = '(' + operandl + nextc + operand2 + ')'; s.push (infix); i++; 8. 9. 10. 11. } 12. else if (Character.isDigit (nextc)){ int start = i; while (Character.isDigit (postfix.charAt (i)) i++; infix = postfix.substring (start, i); s.push (infix); 13. 14. 15. 16. 17. } else i++; 18. 19. } 20 return s.pop () ; 21. } (a) Rewrite only the lines of code that need to be changed so that the above function converts a postfix expression to a prefix expression. (b) Describe in words what changes are needed on the above given convert () function so that it…arrow_forwardInstructor: Muhammad Haris Due Date: December 3 Question 1: Take a character string from user as input and check if the word is a palindrome. For example: Deed, madam etc. Hint: Use Stackarrow_forward
- C++ code Screenshot and output is mustarrow_forwardAlert - don't use AIarrow_forwardC++ Programming. Theme: Standard string manipulation functions - string concatenation, comparison, character search, string search, replacement and deletion. Task : Write a program that replaces the second letter of every word in char string A with the third letter of every word in string B to get string S.arrow_forward
- When the * operator’s left operand is a list and its right operand is an integer, the operator becomes this. a. The multiplication operator b. The repetition operator c. The initialization operator d. Nothing—the operator does not support those types of operands.arrow_forwardC++ Code: Write a program that finds word differences between two sentences. The input begins with an integer indicating the number of words in each sentence. The next input line is the first sentence and the following input line is the second sentence. Assume that the two sentences have the same number of words and no more than 20 words each. The program displays word pairs that differ between the two sentences. One pair is displayed per line. Ex: If the input is: 6 Smaller cars get better gas mileage Tiny cars get great fuel economy then the output is: Smaller Tiny better great gas fuel mileage economy Add a function named ReadSentences to read the input sentences into two string vectors. void ReadSentences(vector<string>& sentence1Words, vector<string>& sentence2Words, int wordCount) main() already contains code to read the word count and call ReadSentences(). Complete main() to display differing word pairs.arrow_forward#include <stdlib.h>#include <string.h>#include <stdio.h>#include "stack.h" /* Checks whether the parenthesis in str are balanced using the stack. Returns 1, if balanced 0, if unbalanced An expression has balanced parenthesis if it satisfies the following conditions: 1. The first observed parenthesis cannot be a closing parenthesis 2. All opening parentheses should have matching closing parenthesis 3. The parentheses cannot be intertwined but can be nested*/int parenthesis_balance_check(LINKED_STACK stack, char* str); int main() { return 0;} PLEASE ONLY USE "C" LANGUAGE, DONT USE "C#" AND "C++"arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education