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
Microsoft has developed the Active Directory Domain structure so that a central authority, called the __________, is the reposit
Zielflug [23.3K]

Answer: Domain controller

Explanation: Active Directory is the technology developed by Microsoft which provides help in centralized handling and managing of the devices on any network.  It has the ability of operating internet servers as well as local servers.

Domain controller is the main server unit for where the database of Active directory is deposited.It keeps the records related with standards, authentication , authorization etc , which are defined as the domain security data record.

8 0
3 years ago
Write a pyhton program to calculate area of a circle?
marta [7]

Answer:

The code to calculate the area of a circle is:

from math import pi

def circleArea(radius):

 if radius > 0:

   return pi * (radius ** 2)

 else:

   return None

if __name__ == '__main__':

 radius = 5

 print("Radius: {} Area: {}".format(radius,circleArea(radius)))

Explanation:

A detailed explanation of each line of code is given below.

#Define the number pi used to calculate the area

from math import pi

#We define a function that calculates the area of a circle

def circleArea(radius):

#Check if the radius is valid ( radius > 0) since there aren´t negative radius

 if radius > 0:

#Compute the area formula for a circle \pi * radius^{2}

   return pi * (radius ** 2)

 else:

#Return None if the radius is invalid

   return None

#Run the function we´ve defined

if __name__ == '__main__':

#Define a radius

 radius = 5

#Call the function and parse the radius through it, then print the result

 print("Radius: {} Area: {}".format(radius,circleArea(radius)))

8 0
3 years ago
Spelling and grammar checking options can be controlled at the word options dialog box. To display this dialog box, begin by cli
Cerrena [4.2K]
By clicking the file tab
8 0
4 years ago
A company that manufactures machine parts orders a new system that makes products at ten times the speed of the earlier machine.
patriot [66]
Autonomic computing???????????????????????????????
7 0
3 years ago
Please explain the following joke: “There are 10 types of people in the world: those who understand binary and those who don’t.”
garik1379 [7]

It means that there are people  who understand binary and those that do not understand it. That is, binary is said to be the way that computers are known to express numbers.

<h3>What is the joke about?</h3>

This is known to be a popular  joke that is often  used by people who are known to be great savvy in the field of mathematics.

The joke is known to be one that makes the point that a person is implying that the phrase is about those who only understands the decimal system, and thus relies on numbers in groups of 10.

The binary system is one that relies on numbers that are known to be  in groups of 2.

Therefore, If the speaker of the above phrase is one who is able to understand binary, that person  would  be able to say that that the phrase  is correctly written as  "there are 2 types of people that understand binary".

Learn more about binary from

brainly.com/question/21475482

#SPJ1

4 0
2 years ago
Other questions:
  • You have a large company, and it is important to your business that your employees' work is backed up regularly. Which network w
    7·2 answers
  • If a disk drive has 8 surfaces and there are 1024 tracks per surface with 256 sectors per track and 512 bytes/sector. What is th
    9·1 answer
  • __________________ are evaluations of a network
    6·1 answer
  • A digital device Select one: a. uses electricity to run it. b. uses symbolic representations of data in the form of code. c. req
    7·1 answer
  • How many questions do you need to have on brainly before being able to send messages?
    14·1 answer
  • One reason to move to a paperless society is that printers are becoming prohibitively expensive true or false
    13·2 answers
  • 1.6.M - Assignment: Understanding If Else Statements in Python
    7·1 answer
  • Question #8
    5·1 answer
  • PLSS HELP ASAP ILL GIVE BRAINLIES THANKS
    7·2 answers
  • In cybersecurity, a threat actor is an individual or an entity responsible for cyber incidents against the technical equipment o
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!