Skip to content

Updating the parentheses_checker.cpp code #8760

@Dhaval-0511

Description

@Dhaval-0511

Issues found and fixed in parentheses_checker.cpp:

  1. Use of non-standard header <bits/stdc++.h>:

    • Issue: <bits/stdc++.h> is a GCC-specific header that includes all standard libraries.
      This reduces portability and increases compile time unnecessarily.
    • Fix: Replaced with specific standard headers: , , and .
  2. Single line input only:

    • Issue: The code reads only one line from input and then exits, which limits usage in batch testing.
    • Fix: Changed to a loop reading multiple lines until EOF to allow processing multiple input lines.
  3. Lack of descriptive comments for functions and code blocks:

    • Issue: Code lacks sufficient inline comments, which may confuse future readers or collaborators.
  • Fix: Added clear, concise comments explaining each function’s purpose and key logic points.
  1. Vague input prompt message:

    • Issue: The prompt only requests a single line and doesn't clarify how to end input.
    • Fix: Updated the prompt to instruct users on how to input multiple lines and how to terminate input.
  2. Unused commented code with vector tests:

    • Issue: Unnecessary commented-out vector tests in main(), cluttering the code.
    • Fix: Removed or suggested to move to separate unit tests to keep main() clean and focused.
  3. Minor formatting and style inconsistencies:

    • Issue: Inconsistent indentation and style affect readability.
    • Fix: Reformatted code consistently following common C++ style conventions.
  4. Ignored other characters in string without comment:

    • Issue: The treatment of non-parenthesis characters was implicit and not clearly noted.
    • Fix: Added a brief comment to clarify that non-bracket characters are ignored.

Summary:
These fixes improve code clarity, portability, usability for multiple inputs, maintainability, and user experience.
I can solve these all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions