The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Write a program to implement Algorithm 3-9, “Parse Parentheses,” matching
braces rather than parentheses. In your implementation, push the line
number into the stack rather than the opening brace. When an error
occurs, print the line number for the unmatched opening brace or
unmatched closing brace. Test your program by running the source code
through itself (there should be no errors) and then test it with the following
small program:
program.
Test brace errors.
} line 2 closing brace is not paired
No braces.
{opening brace is paired on same line}
No braces.
{opening brace paired later
No braces.
} Closing brace paired two lines up.
{{{ Line 9. Three braces--only two paired.
} First closing brace
} Second closing brace.
End of program. One opening brace left.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on-----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------