Help with this C++ Data Structures Project Using good OOP, write a C++ program that will determine if a string has balanced delimiters. Be sure to use good programming methodology and keep your project modular. Use private member functions and variables. Use public member functions for a constructor (where appropriate) and a driver method only. These specifications do not give a list of method names to be used. It is assumed the program will use several methods doing one task each. NOTE: Any submission that uses global variables or does not use a class and object appropriately will result in a project grade of 0. A string may use more than one type of delimiter to bracket information into blocks. For example, a string may use braces { }, parentheses ( ), and brackets [ ] as delimiters. A string is properly delimited if each right delimiter is matched with a preceding left delimiter of the same type in such a way that either the resulting blocks of information are disjoint, or one of them is completely nested within the other. Write a program that uses a single stack to check whether a string containing braces, parentheses, and brackets is properly delimited. Use input file string.txt as input to test your program. Each line in the input file is a string. If the string is properly delimited, display a message stating so. If it is not properly delimited, display a message stating so. For example, if the input file contains the following 3 lines of strings: if (a[i] > b[i]) while (c[index] < 0) { a++; b--; c[index++];} for ({int i = 0; num[i }]; would display the following output: Processing input file... String: 1. is properly delimited 2. is properly delimited 3. is not properly delimited End of file. Another input file Example called string.txt: if (denominator[x] == 0) cout << "ERROR: {Cannot divide by zero.\n}"; while (number[0] > number[1] ) { ((number[i]++; } num[i+1]--; )) for ((int j = 0; object[j + k]); j++) do { (x = x - 7;) { ((y = number + x) / 4) } }
Help with this C++ Data Structures Project
Using good OOP, write a C++ program that will determine if a string has balanced delimiters.
Be sure to use good programming methodology and keep your project modular.
Use private member functions and variables.
Use public member functions for a constructor (where appropriate) and a driver method only.
These specifications do not give a list of method names to be used. It is assumed the program will use several methods doing one task each.
NOTE: Any submission that uses global variables or does not use a class and object appropriately will result in a project grade of 0.
A string may use more than one type of delimiter to bracket information into blocks. For example, a string may use braces { }, parentheses ( ), and brackets [ ] as delimiters.
A string is properly delimited if each right delimiter is matched with a preceding left delimiter of the same type in such a way that either the resulting blocks of information are disjoint, or one of them is completely nested within the other.
Write a program that uses a single stack to check whether a string containing braces, parentheses, and brackets is properly delimited.
Use input file string.txt as input to test your program.
Each line in the input file is a string. If the string is properly delimited, display a message stating so. If it is not properly delimited, display a message stating so.
For example, if the input file contains the following 3 lines of strings:
if (a[i] > b[i])
while (c[index] < 0) { a++; b--; c[index++];}
for ({int i = 0; num[i }];
would display the following output:
Processing input file... String: 1. is properly delimited 2. is properly delimited 3. is not properly delimited End of file. |
Another input file Example called string.txt:
if (denominator[x] == 0) cout << "ERROR: {Cannot divide by zero.\n}";
while (number[0] > number[1] ) { ((number[i]++; } num[i+1]--; ))
for ((int j = 0; object[j + k]); j++)
do { (x = x - 7;) { ((y = number + x) / 4) } }
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 6 images