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!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#include <iostream> using namespace std; const int X=9; const int Y=7; int main() { char Spielfeld[X][Y]; int x, y; char cx, cy; for (x=0; x<X; x++) { for (y=0; y<Y; y++) { Spielfeld[x][y] = '.'; } } // Anzeige und Eingabe bool SchleifenEnde=false; int xin, yin; do { cout << " 1 2 3 4 5 6 7 8 9" << endl; for (y=0; y<Y; y++) { cout << (char)('A'+y) << " "; for (x=0; x<X; x++) { cout << " " << Spielfeld[x][y]; } cout << endl; } cin >> cx >> cy; xin = cx - '1'; yin = cy - 'A'; if (xin>=0 && xin<9 && yin>=0 && yin<7) { Spielfeld[xin][yin] = 'x'; } else { SchleifenEnde = true; } } while (!SchleifenEnde); } |
C-/C++-Quelltext |
|
1 2 |
xin = cx - '1'; yin = cy - 'A'; |
idontknow
unregistriert
idontknow
unregistriert
C-/C++-Quelltext |
|
1 2 3 4 5 6 |
//Free Hand code: bool IsCharLetter(std::string s, int pos) { return (int)s[pos] >= 'A'; } // so in etwa, der ansatz.... |
Werbeanzeige