cout << \"Enter an expression and press return.\" << endl; cin.get(symbol); whil
ID: 440665 • Letter: C
Question
cout << "Enter an expression and press return." << endl;
cin.get(symbol);
while (symbol != ' ' && balanced)
{
if (IsOpen(symbol))
stack.Push(symbol);
else if (IsClosed(symbol))
{
if (stack.IsEmpty())
balanced = false;
else
{
openSymbol = stack.Top();
stack.Pop();
balanced = Matches(symbol, openSymbol);
}
}
cin.get(symbol);
}
try
{
stack.Push(item);
stack.Pop();
}
catch(FULLSTACK
if (balanced)
cout << "Expression is well formed." << endl;
else
cout << "Expression is not well formed." << endl;
return 0;
}
Explanation / Answer
this is well formed............
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.