Problem Description: Your friend keeps finding mistakes in his code due to unmatched brackets errors. You, as a good friend, decided to help him by developing a program that will find errors in the usage of different types of brackets. A Code can contain any of the following brackets []{}(), where the opening brackets are [,{, and (and the closing brackets corresponding to them are ],), and ). Being a good friend, you want your program not to only detect that there is an error in the usage of brackets, but also point to the exact place in the code with the problematic bracket.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

i need this code and i want it running please

Problem Description:
Your friend keeps finding mistakes in his code due to unmatched brackets errors. You, as a good
friend, decided to help him by developing a program that will find errors in the usage of different
types of brackets. A Code can contain any of the following brackets []{}(), where the opening
brackets are [,{, and (and the closing brackets corresponding to them are ],}, and ).
Being a good friend, you want your program not to only detect that there is an error in the
usage of brackets, but also point to the exact place in the code with the problematic bracket.
Using C++/CPP
Requirements:
1. Write a program that finds the first unmatched closing bracket which either does not
have an opening bracket before it, or closes the wrong opening bracket, like } in ()[}. If
there are no such mistakes, then it should find the first unmatched opening bracket
without the corresponding closing bracket after it, like (in {}([]. If there are no mistakes,
you should output "No Mistakes".
2. If there exists a mistake then your program should output the index of the first
unmatched closing bracket in the input string, and if there are no unmatched closing
brackets, output the index of the first unmatched opening bracket in the input string.
Note: In case of unmatched brackets you will always look for the first unmatched
closing bracket, if there are no unmatched closing brackets, then you will look for the
first unmatched opening bracket.
Transcribed Image Text:Problem Description: Your friend keeps finding mistakes in his code due to unmatched brackets errors. You, as a good friend, decided to help him by developing a program that will find errors in the usage of different types of brackets. A Code can contain any of the following brackets []{}(), where the opening brackets are [,{, and (and the closing brackets corresponding to them are ],}, and ). Being a good friend, you want your program not to only detect that there is an error in the usage of brackets, but also point to the exact place in the code with the problematic bracket. Using C++/CPP Requirements: 1. Write a program that finds the first unmatched closing bracket which either does not have an opening bracket before it, or closes the wrong opening bracket, like } in ()[}. If there are no such mistakes, then it should find the first unmatched opening bracket without the corresponding closing bracket after it, like (in {}([]. If there are no mistakes, you should output "No Mistakes". 2. If there exists a mistake then your program should output the index of the first unmatched closing bracket in the input string, and if there are no unmatched closing brackets, output the index of the first unmatched opening bracket in the input string. Note: In case of unmatched brackets you will always look for the first unmatched closing bracket, if there are no unmatched closing brackets, then you will look for the first unmatched opening bracket.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education