Advertisement

More help :(...

Started by March 03, 2002 01:33 AM
11 comments, last by Scott_U 22 years, 6 months ago
Okay, here''s my problem. I making a game in Dev-C++. It''s a text based RPG. I want the player to be able to create a person to use in the adventure. I need to know how to how to take keyboard input, set it to a string as a variable, and then later on save it to file for future loading. Thanks to all who replay. Scott
Check out http://www.gametutorials.com/Tutorials/Console/Console_Pg1.htm

There are some good tutorials there which explain what your looking for.

Best of luck,
Advertisement
Thanks, but those are in VC++ :-/ Anyone else?
Dude - those tuts are practically written in C. I''ve "devolved" a few of them myself. They ought to work in Dev-C++ without much fussing.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Oh, thank you then
Give em a shot and come back if they don''t work for you
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Advertisement
I tried em. They aren''t what I''m looking for. I''ll try to explain better. For my text RPG I''m going to ask for the persons name, race, and faction. When they type in the answer I want it to define a variable so it can be used in the rest of the code. Such as

  #include <iostream.h>//global integersint life = 100;int main();{cout << "Your current life is " << life << " out of 100" << endl;return 0;}  


That *should* (dunno if I got it all right but you should undertsand) put the integer in there if/when it changes and save it. So I want to be able to do that at any point in the game. Then from a certain point save it to file. If that makes sence can anyone help? Or chat with me, I have MSN(SSunderwood@hotmail.com) and AIM(Scott Da Hobo), if anyone is willing to help IM me. Thank you.
Very quickly, you''ll want to use ''cin'' instead of ''cout'' for getting information from the command prompt.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Yeah, I know, I want to use Cin to get input and use the input to define (?) a variable or string or something. I don''t know which to use.
Quick Example.

  int Life;Cout << "Enter Life ";Cin >> Life;  


For saving /loading look up :

''How to read from a file to an integer?''

A thread on the general programming forum.

,Jay

This topic is closed to new replies.

Advertisement