Issue with "The Scope of Things"

I’m having a problem with The Scope of Things where I can’t complete the first instruction, even if I copy the solution’s code. Here’s the code I ran, which is exactly the same as the solution code:

#include <iostream>

void enter_code(int passcode) {
  if (passcode == 0310) {
    std::string secret_knowledge = "";
    std::cout << secret_knowledge << "\n";
  } else {
    std::cout << "Sorry, incorrect!\n";

int main() {

And when run, I fail the instruction and get the message “Move secret_knowledge into enter_code() so that it only prints if the correct code is entered.”

Hello, @dev9965271552, and welcome to the forums.

I think the SCT is expecting you to put the assignment to secret_knowledge inside the enter_code function, but not inside the conditional if statement. Try moving it to right before the if.

1 Like

I’ve tried that out and it still doesn’t complete the first instruction.


I see what you mean. This is a bug for sure in the exercise. I would just click image , and move on.