Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Suchergebnisse

Suchergebnisse 1-3 von insgesamt 3.

Werbeanzeige

10.06.2010, 19:32

Forenbeitrag von: »Suicide and Redemption«

Programmabsturz: Gleicher Code - einmal funktionierts, einmal nicht.

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...

10.06.2010, 19:18

Forenbeitrag von: »Suicide and Redemption«

Programmabsturz: Gleicher Code - einmal funktionierts, einmal nicht.

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...

10.06.2010, 18:58

Forenbeitrag von: »Suicide and Redemption«

Programmabsturz: Gleicher Code - einmal funktionierts, einmal nicht.

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...