C++ Code not working, what is the missing piece in this code? Sinclude ciostream> #include Sinclude using name space std; int main () string x; stack < char, vectore char> > iStack; boolean status=true; cout << "Enter series of parentheses: ": getlinelcin, x): or linti=0; iex.length(): i++M/measure the length of the string input if (xli] == T || x[i] == '("|| xti] == 1) iStack.push(x[ill: else { if not opening grouping symbol if(xti) == 'I) { ifiStack.isEmpty() || iStack.top() != T) { return false j else if (xli) == "Y) { ifriStack. isEmptyl) || iStack.topl) != T) { return false } else if (xli) == '}){ if(iStack.isEmpty() || iStack.topl) != '() { return false iStack.popl): Jif (iStack.empty0) cout << "Balance!" << endl; else cout <« Not Balance!" << endl;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Find missing piece of code? And do code, share screenshot with output. 

C++ Code not working, what is the missing piece in this code?
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main ()
{
string x;
stack < char, vectore char> > iStack;
boolean statustrue;
cout << "Enterseries of parentheses: ":
getline(cin, x):
for (inti=0; icx.length(); i++N/measure the length of the string input
if (xli) == '" || xli] == '{' || xli) == T')
iStack.push(x[il):
else
{ /if not opening grouping symbol
if(x[i] == 'I') {
if(iStack. isEmpty() || iStack.top() != T) {
return false
} else if (xli) == 'Y) {
if(iStack.isEmpty() || iStack.top()!= ") {
return false;
}
} else if (x[i) =='}') {
if(Stack. isEmpty() || iStack.top() != '{") {
return false
}
iStack.pop():
Jif (iStack.empty())
cout << "Balance!" << endl;
else
cout << "Not Balance!" << endl;
Transcribed Image Text:C++ Code not working, what is the missing piece in this code? #include <iostream> #include <string> #include <vector> using namespace std; int main () { string x; stack < char, vectore char> > iStack; boolean statustrue; cout << "Enterseries of parentheses: ": getline(cin, x): for (inti=0; icx.length(); i++N/measure the length of the string input if (xli) == '" || xli] == '{' || xli) == T') iStack.push(x[il): else { /if not opening grouping symbol if(x[i] == 'I') { if(iStack. isEmpty() || iStack.top() != T) { return false } else if (xli) == 'Y) { if(iStack.isEmpty() || iStack.top()!= ") { return false; } } else if (x[i) =='}') { if(Stack. isEmpty() || iStack.top() != '{") { return false } iStack.pop(): Jif (iStack.empty()) cout << "Balance!" << endl; else cout << "Not Balance!" << endl;
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY