RunestoneInteractive / RunestoneInteractive/rs

Incorrect Example Code - C++ 240-0C1 3.7 Balanced Symbols

Open
#632 0 comments 0 reactions 1 assignee View on GitHub

@pearcej is already working on this.

Since Jan 15, 2025.

Dominant language
TypeScript
Stars
69
Forks
117
Avg merge
6d 4h
Merged PRs (30d)
24

Description

In Oakton CSC-240-0C1 section 3.7 https://runestone.academy/ns/books/published/CSC-240-0C1-CPlusPlusDS-OaktonCollege-Spring2025/LinearBasic/BalancedSymbolsGeneralCase.html the example code in C++ doesn't work as intended because it doesn't check the index of the open symbol against the index of the closed symbol in matches(), only that there is an opening symbol to pair with the closing symbol. The Python implementation does check index, and so doesn't suffer this bug. This can be confirmed as a C++ only bug by testing "( [ ) ]" in each language; C++ sees it as a pass, because it isn't checking parentheses versus brackets, whereas Python fails it. Images attached with only my test line added to each language - code is otherwise unaltered from what is presented as the example.
Screenshot 2025-01-15 121227
Screenshot 2025-01-15 121243

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.