text RPG help

Hello i decided to make a small text base rpg game, but i might add a GUI with SDL when im done. It is based on real life and nothing is unrealistic in it. I was wondering how i could make like a stock market where the shares eaither increase or decrease in value over time. SO far i have money and some ways to make and lose money. My stock market is entering how many shares i want then a random number being generated between one and six, and if its <= 3, then you make a profit of the (share value * 1.5). And if you hire a stock broker, then it's if either two random numbers are less than or equal to three so you have a better chance of getting it. I save my characters money in a text file and so i read from it so you can save the game.

MAIN QUESTION:
How could i make it so my character buys shares, then over time the shares may increase a bit, or decrease a lot or something, then he can sell the share whenever.

ALSO:
I have a class called invest.h where it has the menu () function and the shops and stock market and in my main, all i do is call the invest object.menu();
And the menu calls all the other functions based on where you want to go, but when i finish with the stock market or call:
printBalance() { cout <<balance;}
it prints it then immeditaly call the menu() function again whihc is bad because at the start of each funtion i call cout << "\n\n\n\n\n\n\n\n\n"; so the window clears, and i have to scroll up to see my balance or something cin.get() doesnt wait for me...

THANKYOU in advance for reading it :)
Main Question:
That would be something you would have to figure out, depending on your code.

Also:
Sounds like you are mixed formatted and unformatted input.
e.g.
1
2
3
4
int x;
std::cin>>x;
//later
std::cin.get(); //skipped!? 

This is because std::cin>> will leave junk in your buffer, so when you get to std::cin.get() you will have extra characters in it. You'll have to clear those out manually or get your input in a way that doesn't leave extra junk in the buffer.
Topic archived. No new replies allowed.