I'm running a program in C++ on a Chromebook Penguin terminal. The program runs perfectly the first time, but on consecutive runs it acquires different results. I suspect that this is because the terminal remembers the variables from before. Is there any way to resolve this issue in my code?
closed as off-topic by gnat, BobDalgleish, 17 of 26, Christophe, Bart van Ingen Schenau Sep 23 at 14:50
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking for assistance in explaining, writing or debugging code, or using coding tools, are off-topic here. These can be asked on Stack Overflow if they include the desired behavior, a specific problem or error, and a Minimal, Reproducible Example of the problem." – gnat, BobDalgleish, 17 of 26, Christophe, Bart van Ingen Schenau
This is most likely a problem with your code (such as relying on uninitialized variables, or more likely working with external files or other state that are not cleared before each run).
So, the answer is "yes", you can fix it in your code by identifying and fixing the bugs.
Have you tried running the program in a different environment such as a vanilla linux system? If not, it's probably a bit premature to put the blame on Chromebook penguin :-)