18. November 20222 j Autor #include <iostream> using namespace std; int main() { int points; int rows = 9; int cols = 6; int Field[rows][cols]; int N = 45; int y; int x; for (int i = 0; i < rows ; i++){ for(int j = 0 ; j < cols; j++){ Field[j] = 0; } } cout << "Wie Viele Punkte wollen Sie: "; cin >> points; if(points != N){ cout << "X und Y eingeben: " << endl; for (int i = 1 ; i <= points ; i++){ cout << "Eingabe " << i << " : "; cin >> x >> y; while (x > 50 || y > 9) { cout << "falsche Eingabe\n"; cout << "Eingabe " << i << " : "; cin >> x >> y; } if(x % 10 == 0){ x = x / 10; Field[y][x] = 1; } } cout << endl; } else{ cout << "Falsche Eingabe" << endl; } for(int i = rows; i > 0; i--) { cout << i << "|" ; for (int j = 0; j < cols; j++){ if(Field[j] == 1){ cout << "*"; } cout << " "; } cout << "\n\n\n"; } cout << "0" << "|"; for(int j = 1; j < cols; j++) { cout << "---------" << j; } }
Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.