Problem after replacing std::endl with \n

I’ve replaced all of the instances of std::endl; with \n but I found that there’s no longer a line after the last hint - my code seems identical to Gavin’s but I can’t see how to add a new line to the end…

// Print sum and product to the terminal
    std::cout << "+ There are 3 numbers in the code\n";
    std::cout << "\n+ The codes add up to: " << CodeSum;
    std::cout << "\n+ The codes multiply to give: " << CodeProduct;

You are a secret agent breaking into a secure room…
You need to enter the correct codes to continue…

  • There are 3 numbers in the code

  • The codes add up to: 9

  • The codes multiply to give: 24<- Guess is being prompted here
    <-Instead of here

Interestingly, I can hit Enter to create a new line, add a guess (true or false) and the result of the guess functions as it should - I’d just prefer the guess to be made on a new line without hitting enter! :smiley:

Resolved :slight_smile: He covered it in the next section.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms