Solved by Expert Tutors
Solved by Expert Tutors
Question

Hi I need help for this assignment.

Use the STL stack container in a program that reads a string, an arithmetic expression to be exact, one character at a time, and determines if the string has balanced parenthesis - that is, for each left parenthesis there is exactly one matching right parenthesis later in the string.                           


Use the following strings to test your program.


1.   A+ B - C

2.   A * B / (C + 9)

3.   A * ((B / C) + D + (E - 5)

4.   A * (B / C) + D + (E - 9))


The output should look like this:


        String: A + B - C                              No parenthesis

String: A * B / (C+9)                       Matching parenthesis

String: A * ((B / C) + D + (E - 5) Parenthesis don't match. Missing right parenthesis

String: A * (B / C) + D + (E - 9)) Parenthesis don't match. Missing left

parenthesis

Step-by-step answer

The student who asked this found it Helpful

gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem i

s ante, dapibus a molestie co

sum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur

ipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellen

  • facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac
  • cing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. F

ctum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tort

et, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce du


usce dui lectus, congue vel laoreet ac,

  • acinia pulvinar tortor nec facilisis. P

onec aliquet. Lorem ipsum dolor sit amet, consecte

ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing

  • rem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dap

rem ipsum dolor sit amet,

acinia pulvi

ipsum dolo

a molestie conseque vel laoreet aac, d

gueac, dictugueing,squceicDonec aliquet. Lmolestie consequat, ultrices ac magna. Fusce dui lectus, congue velipiscing elit. Nasumllentac,onec aliquet. Lorem ipsuipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesqipiscing elit. Naconguecta molestie consequfficitur laoreet. Nam risus ante, dapibus a molestipiscing elit. Naneclestie congue vel laoreet ac, dictuat, ultrices ac magna. Fusteonecctipsum dolor sit ameitur laoreet. Nam risus ante,ipiscing elit. Naiaipsum dolor sit amet, c0, dictum vitae odio. Don0a molestie consequnec facilisis. Pellentesque dapibus efficitur laipiscing elit. Naic,iam risus ante,0lestiecttrices ac magna. Fusce dui lectus, congue vel laorecongue vel laoreet ac, dictum vitae odio. Donec aliquetec aliquet. Lorem ipsum dolor situ,cttesque dapibuceet, consectetur adipiscing elit. Nam lacinia pulvinrisus ante, dapibus a molesticonsectetur adipiscing elit. Nam lacinia pulvinar tortorcte vel laoreet ac, dictum vitae odio. Donec aliquet. Loipiscing elit. Namrisus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aonecgueu,cttesque dapibusuet, consectetur adipiscing elit. Nam lacinia pulviniscing elit. Nam lacinia pulvinar toicitur laoreet. Nam risus ante, dapibus a molestiuce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. LoremFusce dui lectus, congueac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet,neclestie con, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus anor negue0ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Loremonecfficitur laoreet. Nam risus ante, dapibus a molestie consequat, ulongue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorecing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequata. Fusce dui lectus, conlestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortoronecdictum vitae odio. Donec aliquet. Lorem ipsum doldictum vitae odio.ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec alique, consectetur adipiscing elit. Nam laciipiscing elit. Nauonec aliquet. Lorem ipsum dolor sit amet, coipsum dolor sit amet, consectetur adipisciec aliquet. Lorem ipsum dolor situitur laoreet. Nam risus ante, dapibus a molestie consequat, u0et, consectetur adipiscing elit. Nam lacinia pulvinur laoreet. Nam risus ante, daicitur laoreet. Nam risus ante, dapibus a molestineclestie contrices ac magna. Fusce duionec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing eonecdictum vitae odio. Donec aliquet. Lorem ipsum dolneclestie conctum vitae odio.ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante,onecm ipsum dolor sit amet, consectetusque dapibus efficitur laoreet. Nam risus ante, dapibec aliquet. Lorem ipsum dolor sitneclestie conipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesqrem ipsum dolor sit amet, consectetuor negue0a mo

, ultric

balanced outputs.png

balanced outputs.png
sum dolor a molestie consequat, ultri a. Fusce dui l rem ipsum d usce dui lectus, cong ipiscing el ec facilisis. Pellent rem ipsum d usce dui lectus, cong ac, dictum vitae odio. ce dui lectus, congu

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Computer Science tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes