CB100

Notas, resueltos y tps de la materia Algoritmos y Estructuras de Datos
Index Commits Files Refs README
commit 8997693d48e52321c5d826c8b3ff66c02372b861
parent 5b54755389aac9fd0d113b6c00e503b125d08e36
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Mon,  1 Apr 2024 00:05:34 -0300

Move `current_player_string` definition to beginning of func

Diffstat:
Mguias/2/ej12.cpp | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/guias/2/ej12.cpp b/guias/2/ej12.cpp
@@ -60,16 +60,15 @@ void game_clear_board(void) {
 }
 
 void game_player_status_msg() {
+    std::ostringstream current_player_string;
     if(game_status == PLAYING) {
         player_status = std::string("Player ");
-        std::ostringstream current_player_string;
         current_player_string << current_player+1;
         player_status += current_player_string.str();
     }
     else if (game_status == WIN) {
         unsigned int player_won = ((current_player == PLAYER_1) ? PLAYER_2 : PLAYER_1);
         player_status = std::string("Player ");
-        std::ostringstream current_player_string;
         current_player_string << player_won+1;
         player_status += current_player_string.str();
         player_status += " Wins!!";