Suchergebnisse
Suchergebnisse 1-3 von insgesamt 3.
Hier dann mal der komplette Quellcode. So schmiert er ab: C-/C++-Quelltext 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 //battleships.h class Battleships{ public: Battleships(); ~Battleships(); void clear(); void drawEnemyField(); void drawOwnField(); void getCol(); void getRow(); void shoot(); bool runGame; bool turn; private: char col; char cols[10]; int row, i, x, y; char fieldPlayer[10][10]; char fieldComputer[10][10]; void drawField(char player[10][10]); }; C-/C++-Quelltext 1 2 3 4...
Hiermal etwas mehr, unwichtige Sachen aber weggelassen C-/C++-Quelltext 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 //battleships.cpp #include "battleships.h" #include "constants.h" #include <stdlib.h> #include <iostream> Battleships::Battleships(void){ for( x = 0; x < 9; x++ ){ for( y = 0; y < 10; y++ ){ fieldPlayer[x][y] = '.'; fieldComputer[x][y] = '.'; } } for( i = 0; i < 10; i++ ){ cols[i] = 65+i; } } C-/C++-Quelltext 1 2 3 4 5 6 7 8 9 10 //battleships.h class Battleships{ public: Battleships...
Hi ich bin recht neu in C++ und versuche mich gerade an "Schiffeversenken" als Konsolenapplikation. Ich habe allerdings ein Problem beim Befüllen eines Arrays. Die markierte Zeile verursacht einen Absturz (wenn ich sie auskommentiere läuft das Programm). Kann mir jemand weiterhelfen? C-/C++-Quelltext 1 2 3 4 5 6 7 8 9 char fieldPlayer[10][10]; char fieldComputer[10][10]; //[..] for( x = 0; x < 10; x++ ){ for( y = 0; y < 10; y++ ){ fieldPlayer[x][y] = '.'; fieldComputer[x][y] = '.';//verursacht d...