Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <conio.h>
- #include <cstdlib>
- #include <Windows.h>
- #include <time.h>
- void xy()
- {
- HANDLE hout;
- COORD Position;
- hout = GetStdHandle(STD_OUTPUT_HANDLE);
- Position.X = 0;
- Position.Y = 0;
- SetConsoleCursorPosition(hout, Position);
- }
- class GameFunctions
- {
- private:
- int x = 19, y = 9;
- char player = 'X';
- char cash = '$';
- char object = 'U';
- public:
- char field[30][30];
- GameFunctions() {
- for (int a = 0; a < 20; a++)
- {
- for (int b = 0; b < 20; b++)
- {
- field[a][0] = '|';
- field[a][18] = '|';
- field[a][b] = ' ';
- }
- }
- }
- void DrawField()
- {
- for (int a = 0; a < 20; a++)
- {
- for (int b = 0; b < 20; b++)
- {
- std::cout << field[a][b];
- if (b >= 19) {
- std::cout << std::endl;
- }
- }
- }
- }
- int gx() { return x; }
- int gy() { return y; }
- char gplayer() { return player; }
- };
- int main()
- {
- srand(unsigned(time(nullptr)));
- GameFunctions Take;
- bool ongoing = true;
- Take.field[Take.gx][Take.gy] = Take.gplayer; //Hier ist der Fehler: "GameFunctions::gx" Keine Standardsyntax; "&" zum
- //Erstellen eines Verweises auf das Member verwenden
- do {
- xy();
- Take.DrawField();
- std::cin.get();
- } while (ongoing);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement