Starting from:
$30

$24

lab 25 Solution

Objectives:




Implement and utilize a stack abstract data type



Question 1:




Accompanying this question is a skeleton of a program that defines a Stack class, as well as a main function to read an algebraic expression from the user. Complete the main program and determine if the user has provided an expression with a balanced set of parenthesis. Your algorithm must make use of a stack.




Example Outputs:




Enter an expression




1 + 3




Balanced Parenthesis




Press any key to continue . . .




Enter an expression




1+(3*5-7




Mismatched Parenthesis




Press any key to continue . . .




Enter an expression




5*(3+7)




Balanced Parenthesis




Press any key to continue . . .




Enter an expression




)+3*(7+4




Mismatched Parenthesis




Press any key to continue . . .

More products