Hi there!. I am learning more programming skills. To be honest I already know how to do them, but my emotional skill to sit down and program them is zilch. I need to make a game where I’m doing 85% comfortable stuff and 15% new stuff. I need a prompt for me to make a TINY text-based game. This game will FEATURE the need to use: DATA STRUCTURES, because that's what I’m focusing on learning right now. Your prompt can be a paragraph or something.
Hello. What is your question? How can we help you?
Games are an interesting way in order to increase your skill developing projects. You can use the Terminal which is embedded in Windows. You cannot imagine what you are able to do with this black and ugly prompt - as a game engine. You should take a look at the OLC::ConsoleGameEngine.
There are many little 2d game engines which could be useful for you. It seems to me that you have not many ambitions for your game. So what about creating your own FrameWork? But first, let us know what your question is :)
A struct is one type of a data structure, there are a number of others. C++ has a number of data structures that are part of the language standard, as well as algorithms that are used to manipulate the data structure.
Class and struct are almost identical, the only difference in c++ is public (struct) or private (class) default access of members, which can be overridden in either one anyway.
A data structure is just that: some sort of container that holds data. It can, really, just be an integer! Standard string is a data structure that stores characters. But most of the time when talking about them, its at least an array and often much more involved. Struct/class is a data structure I suppose, always, if you accept that an integer is one, but not all structs are creating a 'container' that holds more than 1 item. If you stick to a more practical requirement that a 'data structure' holds 0 to n blocks of similar items, then MOST struct/class are NOT data structures, really.
the common data structures are:
- array (vector, valarray, pointers-like-arrays, etc in c++)
-lookup table (usually an array where the index is computed from the data for fast lookups, this includes unordered map in c++) -- often called a hash table
-graphs (a pointer to an element that has zero or more pointers to more elements which each have pointers to zero or more elements.... chained up) this includes list (c++ list), trees, graphs
-and the conceptual data structures: things like stack, queue (c++ has vector which can be a stack or queue(bad at it), dequeue, list which can be a stack or a queue, probably others) or things like sets (deduplicated data groups) and various maps (similar but not exactly lookup tables) it also has a stack and queue, but I prefer just about anything else over the official stack/queue.
- and other handy things c++ provides like tuple, pair, which can hold heterogenous items in small groups (basically C-style structs that are crafted for you with minimal syntax)
and, you can mix and match these things. You can have an array of lists that performs like a lookup table, where data that ends up in the same location is just chained up in a small list.
As you study these, there are 3 points that will really help you to understand it.
first, you want to memorize or at least know to look up online the pros and cons of each data structure so you can choose the right one for your program. This is the most critical skill/takeaway from a data structures course.
second, implementation does NOT have to be the classic implementation. A tree can be stored in a vector, as can a linked list, and this can be much more efficient than the school-taught pointer soup approach.
third, most languages provide at least some data structures, only the lowest level or oldest do not (eg, C has almost nothing). USE these as much as you can: building your own is very involved to do it correctly, and even doing a casual drive-by can take a solid day or two.