Is there a simple way to allow user input without having the program "wait" for it?
For example, I want to write a function that counts down from 100 to 0. The only way to stop it would be if the...
Type: Posts; User: Xanderbeard
Is there a simple way to allow user input without having the program "wait" for it?
For example, I want to write a function that counts down from 100 to 0. The only way to stop it would be if the...
Thanks for the replies, I am looking into the posted resources now.
I played around with ascii using simple 2d arrays just to get a feel for how I would do a 2d 'tile-based' game. I worked out a...
I've spent much of my free time, for the last few weeks, learning as much as I can about c++. My first goal was to be to make a text-based rpg. I wasn't concerned, or even very interested, in the...
Thank you very much, this basically answered all of my questions. My Fruit list[100] is just a normal array. I didn't even think of actually using a list.
I'm pretty inexperienced, so I don't...
If I close the debug version of my .exe by literally closing(x) the window. My compiler says there was an access violation. This only happens if there are destructors that would have been called had...
If I hard exit the debug version of my exe, I get a compiling error from class destructors that havn't been called yet. Does this mean I have built the destructors wrong, or is it normal because the...
class Fruit
{
public:
string name;
int quantity;
}apple = {"Apple", 5}, pear = {"Pear", 3}, peach = {"Peach", 2};
Fruit list[100];
Item[100]* inventory; //this line gets errors for me.
Item* inventory[100]; //this way works though, what's the difference?
I need each value in inventory[] to point to the name and quantity of...
I'm trying to make an inventory system for a rpg game, and I'm having a hard time doing it. This is the idea of what I have so far:
class Item
{
public:
void create_item(int...
My save file is getting pretty complicated. It saves strings, ints, and floats.
Having it write the information I want to a .txt is no sweat.
However, reading the various data types is becoming...
Thank you very much. The .ignore did the trick. I did not know mixing input methods would be such a hassle, next time I will look into reading the whole file first ,then sorting it out.
I'm having a hard time reading from a .txt file. Here's a short version of what I have:
LoadFile.open("Save File.txt", ios::in);
getline(LoadFile, name1);
for (int i = 0; i<2;i++)...
Thanks mates, I see where I was confused now. That code I posted was just something I typed for the post-- I wasn't trying to run that.
In my above example. Is there a way to delete the object Potion if the user no longer has any? That would free up the memory used to store information about an object that I don't even need. Or am I...
I'm working on an inventory system for a game. Right now I have:
Struct Item()
{
string name;
int value, quantity, type;
int creator(int);
};
I guess its like I'm moving a mound of dirt with a shovel instead of a tractor. The shovel might be a barbaric way of doing it, but the concept is easy. A tractor on the other hand would be a very...
Thank you! That answers my question.
So what's the smallest amount of code to achieve that?
do
{
main_menu();
}while (choice != 5);
I'm working on a text-based program that is written almost exclusively in functions.
I'm using switch statements for the menu choices. Each case input will call the appropriate function.
So...