Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to use stacks in applications Evaluate a postfix expression Convert from decimal to binary using stacks o Coding exercise 1 - Write a program

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
How to use stacks in applications Evaluate a postfix expression Convert from decimal to binary using stacks o Coding exercise 1 - Write a program to evaluate a postfix expression Extend your code in stlInfixPostfix.cpp Lab 5 to convert expression that contain numbers in place of variable names (e.g., in place of A B C, the expression may be 2 10 5) from infix to postfix. Hint: Beware of the spaces in the expression. Include a function in stlInfixPostfix.cpp with signature double evaluatePostFix(string expression) that evaluates an expression provided in postfix format. You may refer to the textbook or the lecture slides for the algorithm. E.g., 2 10 5 should be evaluated to 52 using your algorithm. Optional extensions: Enable expressions with non-integer and negative numbers. Include operations ++,--, and % . Coding exercise 2 -Convert a decimal number to binary using stacks In this exercise, you are required to think of an implementation to convert a decimal number to binary (output as a string). We discussed the iterative algorithm and recursive algorithm in class. Write the pseudocode of your algorithm in a file called decimalBinaryStacks.pdf. In the same file explain your thinking and references you used. Implement your pseudocode in a file called decimalBinaryStacks.cpp. The code should take an integer as the input decimal number, and the output should either be a string, or output the binary number using cout. You may use the STL stack or your own implementation of stacks. What to turn in A zip file containing stlInfixPostfix.cpp, decimalBinaryStacks.pdf, and decimalBinaryStacks.cpp. Your zip file should be named StacksApplications XXXyYxxx.zip, where Xxxyyxxx is your SJSU ID. E.g., if your SJSU ID is 111000111, your submission will be called StacksApplications_111000111.zip. When to turn in

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

identify the causes of aggression,

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago