im currently sitting on a small priv Project(Qt C++) for myself. I want to simulate a garden in console but im struggling already with basics.
Example:
- Programm starts
- Programm asks user how big the garden should be
- User choses 16x16
- Program creates a Garden with a 16x16 Array where the User can choose where he places plants.
My Code:
#include <QtGlobal>
#include "plant.h"
class Garden {
public:
Garden(quint16 gardenSize);
private:
quint16 gardenSize;
Plant plantarray;
};
-------- ( garden.cpp )
#include "garden.h"
Garden::Garden(quint16 gardenSize) {
this->gardenSize = gardenSize;
this->plantarray = new Plant[gardenSize][gardenSize];
}
But im sitting now for over 4 hours at this problem, testing different solutions but nothing is really working :/
i just want to use that array then like:
if (plantarray[x][y] == nullptr){[...]}
etc ...
Sadly the best solutions i've found were from 10 years ago ant wont work anymore ...
Any Suggestions?