1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
expeople1 [14]
2 years ago
11

Write a program that takes as input an arithmetic expression followed by a semicolon ";". The program outputs whether the expres

sion contains matching grouping symbols. For example, the arithmetic expressions {25 + (3 – 6) * 8} and 7 + 8 * 2 contains matching grouping symbols. However, the expression 5 + {(13 + 7) / 8 - 2 * 9 does not contain matching grouping symbols. If the expression contains matching grouping symbols, the program output should contain the following text: Expression has matching grouping symbol If the expression does not contain matching grouping symbols, the program output should contain the following text:

Computers and Technology
1 answer:
IceJOKER [234]2 years ago
6 0

Answer:

See explaination for the details of the answer.

Explanation:

#include <iostream>

#include <stack>

using namespace std;

int main(){

string str;

cout<<"Enter a String: ";

std::getline (std::cin,str);

bool flag=true;

stack<char> st;

for(int i=0;i<str.size();i++){

if( (str.at(i)>='0' && str.at(i)<='9') || str.at(i)=='+' || str.at(i)=='-' || str.at(i)=='/'|| str.at(i)=='*' || str.at(i)==' ' ){

// cout<<str.at(i) <<"came"<<endl;

continue;

}

if( str.at(i)=='{' || str.at(i)=='(' ){

st.push(str.at(i));

}

else if(!st.empty() &&((st.top() == '{' && str.at(i) == '}') || (st.top() == '(' && str.at(i) == ')')))

st.pop();

else{

flag=false;

break;

}

}

if(!st.empty()){

cout<<"Does not match"<<"\n";

}else{

if(flag)

cout<<"Match"<<"\n";

else

cout<<"Does not match"<<"\n";

}

return 0;

}

See attachment for the output.

You might be interested in
What is the maximum input current fr transformer T10266
RoseWind [281]

THIS IS WHAT I KNOW

40 volts max input/output differential, 2.2 amps max output current. Yes you can use it to make a variable power supply with the LM317 but it is a waste of a good transformer because you can not use its full power output capabilities. You will also not be able to go to very low voltages because of the input/output voltage differential.

                                                HOPE IT HELPS

5 0
2 years ago
What did Francis Ford Coppola and George Lucas create?
garik1379 [7]
. 3d animation markers
7 0
3 years ago
State four features of information​
Xelga [282]

Answer:

This is your answer

8 0
3 years ago
Hello pls answer<br><br><br>what is the use of loop in java​
xxMikexx [17]
The use of loop in java is to run a block of code for a certain number of times.
7 0
2 years ago
In general, a unit test may need drivers and stubs, but not both.<br><br> TRUE OR FALSE
Ymorist [56]

Answer:

True

Explanation:

If a module or code is not ready then the unit test can use the Stubs to simulate a called upon function to test the process. On the other hand if the main unit is not ready the test can use Drivers to simulate the calling of said function to test the rest of the modules.

Therefore, a unit test will use either Drivers or Stubs at a given moment for testing but not both simultaneously.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
3 years ago
Other questions:
  • You're trying to decide which disk technology to use on your new server. the server will be in heavy use around the clock every
    10·1 answer
  • True or False, PDF documents have many benefits, but their main disadvantage is that the formatting of their text and graphic el
    15·1 answer
  • You have developed a prototype of a software system and your manager is very impressed by it. She proposes that it should be put
    5·1 answer
  • What do you call the spreadsheet cell that is in effect and has a heavier black border around it?
    7·2 answers
  • This is the term for the manual process of editing strips of the film before digital editing was created. The term is still used
    9·1 answer
  • Waygate's residential Internet modem works well but is sensitive to power-line fluctuations. On average, this product hangs up a
    6·1 answer
  • How has your perspective changed since the beginning of the class?
    5·1 answer
  • You are reviewing the output of the show interfaces command for the Gi0/1 interface on a switch. You notice a significant number
    12·1 answer
  • Which of the following statements is true regarding a user account? Once a user account has been created, it cannot be completel
    8·1 answer
  • PLEASE HELP ASAP!! Timed test!!
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!