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
the increase and decrease font button and the change text colour button (as shown in the picture )are include in which group ?​
denpristay [2]

Answer:

These are the part of FONT Group on MS word / Excel application where you can increase and decrease font, change text color, highlight text, select font from the list and many other functions.

You can also perform advance functions related to Font by clicking on a small arrow like icon in bottom right corner.

5 0
2 years ago
In the single-site processing, single-site data (SPSD) scenario, all processing must be done on the end user's side of the syste
Lyrx [107]

Answer:

The answer is "Option B".

Explanation:

In the database, the term SPSD is used. It is located on the host computer that helps to access connected dumb terminals. It is usually running on under multitasking, time-sharing operating systems, that enables you to use multiple processes to run simultaneously on a host computer accessing a single DP. It is not used for end user's sides, that's why it is not correct.

3 0
2 years ago
Read 2 more answers
Attribute variables have the same meaning as participants variables. is this true or false?​
zysi [14]

Answer:

true

Explanation:

because I said so dude

5 0
3 years ago
write a program that computes an integer's checksum. to compute the checksum, break the integer into its constituent
Serggg [28]

Using the knowledge in computational language in python it is possible to write a code that computes an integer's checksum.

<h3>Writting the code:</h3>

<em>def checkSum(n):                    # Function definition</em>

<em>    total = 0                       # total variable which returns sum</em>

<em>    c = 0                           # counter variable which count the even position</em>

<em>    while(n!=0):                    # running a loop while n != 0</em>

<em>        r = int(n%10)               #breaking the number into digits</em>

<em>        c=c+1                       # increase counter</em>

<em>        if c%2==0:                  # if counter is even position then double the number </em>

<em>            r = r*2</em>

<em>            while(r!=0):                            # do the process</em>

<em>                total = total + int(r%10)</em>

<em>                r = int(r/10)</em>

<em>            n=int(n/10)    </em>

<em>        else:                       # if counter is odd position then simple add the digit </em>

<em>            total = total + r       # into total</em>

<em>            n=int(n/10)</em>

<em>    return total                    # in the last return the sum of digits</em>

<em># Driver code</em>

<em>n = int(input("Enter Number:"))         # asking user to enter the number </em>

<em>print(checkSum(n))                      # calling the function</em>

See more about python at brainly.com/question/18502436

#SPJ1

8 0
1 year ago
If I make a Zoom Meeting, would you join it?
boyakko [2]

Most likely, yeah lol.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Once the technology for the collection of solar power is in place what will be two benefits of its use
    9·1 answer
  • You bought a monochrome laser printer two years ago. The printer has gradually stopped feeding paper. Which printer component sh
    14·1 answer
  • What type of device is built into a tablet computer and can send data over radio waves to another device such as a laser printer
    10·1 answer
  • When inside a closed work environment, its okay to openly talk with co-workers about PII
    6·1 answer
  • write a method that will return a person's age entered by keyboard. You will need to include at least one instance variable in t
    11·1 answer
  • Each professional association has
    7·1 answer
  • Nuclear batteries use devices called thermocouples, which convert the ____ of a nuclear reaction into electricity.
    9·1 answer
  • A reasonable documentation comment for this program might be public class Questions1_4 { public static void main(String[ ] args)
    6·1 answer
  • AWT
    7·1 answer
  • The ______ process retains copies of data over extended periods of time in order to meet legal and operational requirements.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!