❔ Please help with a simple train reservation simulator (I'm a beginner).
In this train reservation simulator it's supposed to have a maximum capacity of 40 passengers on board. Let's say 50 people wants to hop on the train, it should say 40 on board, 10 has to stay. Well it does that, but the next input (Station 2), let's say another 10 people wants to hop on, then it should say 40 on board 10 has to say, but it says 20 has to stay. So it's adding the previous 10 with the 10 on station 2.
(Sending a screenshot in the comments of how it looks in the console). If anyone can help it would be very much appreciated! My code is mostly written in Swedish but hopefully you'll understand by my comments in the code, if not let me know and I'll change everything. (I've been stuck in this problem for a few hours now).
If anyone who's a beginner as well and want's to connect in PM, feel free.
5 Replies
Here's how it looks in the console. marked with blue (100 has to stay at station 2, 170 has to stay at station 3 when it should be 70 has to stay at station 3).
added more comments
Testa sätt övriga till 0 efter varje gång du skrivit ut övriga
Tack, men funkade inte (om jag gjorde rätt). Svarade dig i PM.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.