Write a program that checks if left and right braces

Assignment Help Data Structure & Algorithms
Reference no: EM13163640

The program and functions should have brief comments describing their purpose, inline comments 

Write a program that checks if left and right braces, brackets, and parentheses are balanced. Your
program should ask the user to provide symbols as a string and store the user provided input in a string named str. Write a function named balanceCheck(str)that will return true is str is balanced and false otherwise. Use a std::stack inside the balance Checkfunction to solve this problem. You can assume that users will not enter any white spaces in between the symbols. You can assume that users will only enter a string consists of braces ({or}), brackets ([or]), and parentheses ((or)).

A sample output is as follows:
Provide a sequence of symbols for balance check: [{(){()()}}]
The expression you have provided is balanced.

Provide a sequence of symbols for balance check: [{{]}}[]
The expression you have provided is not balanced.

Reference no: EM13163640

Questions Cloud

Given a set of integer numbers : Given a set of integer numbers as int A[ ] = { 12, 6, 51, 4, 3, 7, 19, 8, 0, 21}, please write down the divide and conquer procedure of quick sort (step by step), include all left and right positions adjustment, and overwriting.
Windows application that function like a banking account : Create a Windows application that function like a banking account register. Separate the business logic from the presentation layer. The graphical user interface should allow user to input the account name, number, and balance.
Create file lab7.java with a main method. : Create file Lab7.java with a main method. Inside your main method, write a segment of code which instantiates an object of the Student class (This class has been created for you in the  Student.java  file that is provided as part of this lab).
Testing a program based on varying : Testing a program based on varying input values without knowing what the code looks like is called _____.With _____ testing, you make sure that every instruction in the code is executed at least once.
Write a program that checks if left and right braces : Write a program that checks if left and right braces, brackets, and parentheses are balanced
Program that compares the number of possible sequences : Write a c++ program that compares the number of possible sequences of the length L that can be generated. The program must output a formatted list comparing the number of possible sequences for L=5,6,7,8,9. given size N=9
Program that displays the ball at a random : Write a C++ program that displays the ball at a random location and then makes the ball move down to the bottom of the screen. When the ball reaches the bottom of the screen, it should start these actions over again, appear-ing at another random l..
Two cyborgs walk into your home : Two cyborgs walk into your home, both claiming to be oracles for the graph 3-colorability decision problem. They both always give a yes/no answer in constant time for any instance, and are each self-consistent
Design a wireless network : (15%) Allen FINALLY has been able to secure broadband service to his home in a remote area of the country via newly installed telephone lines. He had a powerful desktop. But he wants to be able to sit on his deck when using his new laptop to do his o..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Sort scheduling algorithms according to high throughput

Sort the scheduling algorithms (FCFS, SPF, RR, MLFB) according to each of High throughput (if we take averages of time intervals smaller than the sum of all processes' time)

  Calculations on rows and columns of an array

Make a menu bar with a document menu that includes a Perform Action command and an Exit command. The Perform Action command calculates either the sum or the average of rows or columns in array and displays result in a message box.

  Question about character array

The 2-most important design issues that are specific to character string types are the given, Should strings be simply a special kind of character array or a primitive type?

  Function to swap all the left-right subtrees of binary tree

Write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. write a method singleParent, that returns the number of nodes in a binary tree that have only one child.

  Question related to ms excel

Discuss how do I insert a row in multiple tables on different sheets in the same workbook? I have twelve sheets, one for every month, and the sheets are exactly the same.

  Question about shortest prefixes

A prefix of a string is a substring string at the beginning of the given string. The prefixes of "carbon" are: c, ca, car, carb, carbo and carbon.

  Computations of database characteristics

A file has r=20,000 student records of fixed-length. Suppose the file is ordered by SSN; compute the number of blocks it takes to search for a record given its SSN value by doing a binary search.

  Data warehouse and operational databases

Every big organization has large documents or databases containing data used in operating the business. Does a data warehouse differ from these operational files or databases?

  Binary search tree adt

Write a client method that returns a count of the number of nodes in a binary search tree that contain a value less than or equal to the argument value.

  Describe a fair coin algorithm to returns either 0 or 1

Describe a FAIRCOIN algorithm that returns either 0 or 1 with equal probability, using ONEINTHREE as your only source of randomness.

  Creating a method find ranks in java

Create a method findRanks in Java that accepts an unsorted array of integers vals, and starting and ending rank start and end, numbering ranks from 0,

  Calculate worst-case run-time complexity of algorithm

Calculate the worst-case run-time complexity of your algorithm and prove optimality of the solution it gives. Suppose that the road is a straight line with a western end and an eastern end.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd