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 Ct+/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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question
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 with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT