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]
3 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]3 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
HELP LOTS OF POINTS! I WILL GIVE YOU 100+ POINTS IF ANSWERED CORRECTLY!!!
Delicious77 [7]

Answer:

E) all of the above

Explanation:

Your device can track your location, which means that it will tell where you've been. When you post on social media or just online, you are sharing what you're thinking. Your friends and family can easily be traced back to you, so they know who your friends and family are, and we leave evidence of what we've done because whatever you click gets tracked. hope this helps :)

4 0
2 years ago
What is reference file​
Ratling [72]

Answer:

A reference file is mainly used for reference or look-up purposes. Look-up information is that information that is stored in a separate file but is required during processing.

Explanation:

Hope this helps ;)

8 0
3 years ago
Read 2 more answers
State three (3) benefits of using the internet ​
Hoochie [10]

Answer:

  • Entertainment for everybody
  • Social network
  • Inexhaustible Education
8 0
2 years ago
Read 2 more answers
How can I create an app ? What should I download from the App Store ? How can I put my app in the App Store ? PLEASE GIVE ME THE
crimeas [40]
It's not easy to create an app for cellphones it is harder than to create those for computers. You would need to learn swift coding language to create an application. 
6 0
3 years ago
Read 2 more answers
HELP ASAP!!!
wolverine [178]
The answer on this scenario is B.home. It is the tab being used then in order to have slide layouts, fonts for the formatting and adding images. Also the change in font color can be done. Hope this would be of help.
6 0
3 years ago
Other questions:
  • Using Matlab programming I need to rotate the line defined by x,y by 45 degrees around 2,2
    13·1 answer
  • The unique global address for a web page or other resource on the internet is called the ________.
    7·1 answer
  • Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and a
    10·1 answer
  • Can someone help me, please
    7·1 answer
  • Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both sing
    10·1 answer
  • The diagnostic test that involves watching a computer monitor with alternating checkerboard patterns while an eeg is performed i
    11·2 answers
  • If you are a mathematics student and want to study the secret of writing cryptographic codes, algorithms, encryption and decrypt
    14·1 answer
  • How has music changed with the use of technology?
    14·1 answer
  • Please i need help here.. am giving brainliest.
    11·2 answers
  • Give two differences between ergonomic keyboard and standard keyboard?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!