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 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
Java - Contains the Character
C++
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.…
Chapter 12 Solutions
C How to Program (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] 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++ pleasearrow_forward(True/False): Local variables are created by adding a positive value to the stack pointerarrow_forwardExpression 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
- please answer all parts within 30 minutes ..arrow_forwardanswer 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_forward
- Expression Conversion 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. 3) If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. Please do the program according to the requirements above and it should be in C language...also after the code i want a report that the algorithm explanations of the code plesse don't just copy other student program and give me back please please pleasearrow_forwardExpression Conversion 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. 3) If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. I want the program to be written in C language and want explanation for the algorithm of this programarrow_forwardrin t] (Replace strings) Write the following function that replaces the occurrence of a substring old 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, with new substring a 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
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