From a49ee4918e4f5bad9450c5b666e5192842f59005 Mon Sep 17 00:00:00 2001 From: Awen Lelu Date: Tue, 6 Jan 2026 16:48:32 +0100 Subject: [PATCH] initialise variables with non 0 value --- main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 59b168c..efe6ff6 100644 --- a/main.cpp +++ b/main.cpp @@ -19,16 +19,13 @@ void attack(int humans, int zombies, int *new_humans, int *new_zombies) { } else if (rand() % 100 < infection_chance) { *new_humans = humans - 1; *new_zombies = zombies + 1; - } else { - *new_humans = humans; - *new_zombies = zombies; } } void loop(int hour, int humans, int zombies) { - int new_humans; - int new_zombies; + int new_humans = humans; + int new_zombies = zombies; std:printf("hour: %d| zombies: %d| humans: %d \n", hour, zombies, humans);