Problems with strings.

Started by
5 comments, last by Koobazaur 17 years, 1 month ago
Hi everyone. I am very new to programming and apologise for my lack of knowledge when it comes to my correct use of terminology… I hope I can explain my questions clearly enough. I am currently making a text game using that console window thingy. The problem I have is using a string to take the name of the user’s adventurer. If the user’s name includes a space (it should not, I explicitly tell them not to... but you know people) the program seems to object and the console screen spams away worse than an MMO plat seller. Is there a way I can check user input so that it tells them off for entering a name containing a space? Or maybe take the space as part of the string? I have another unrelated question. Because of a new-years resolution sweepstake at a party my “amusing” friends conspired to make the most technophobic person on the planet into a game programmer. Now that I have some games under my belt I would like to get revenge by pestering them with my trivial projects. How do I distribute my games to my friends? Do I just send them the .exe file? Or is it more complicated than this? Please forgive my lack of knowledge, up until early this year I did not even know how to open a folder on my PC.
Advertisement
What programming language are you using? Assuming C++, this thread from earlier today should help you out.

Distributing your games can be a fairly involved process. At the very least you need the .EXE of course; there may also be some other system-type files that need to be distributed. Typically these are .DLL files. The actual files you need depends heavily on the language you're using, and the particular tools; for instance, distributing a Python game is a different scenario from a C++ game, and even for C++, Visual Studio and the GCC compiler families will have different requirements.

Congratulations on getting this far, though - for a self-proclaimed technophobe it's quite an accomplishment to be writing programs already [smile]

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Language?

Assuming C++, use getline() to read a line of text instead of just a word. Use cin.ignore() to ignore what it in standard input prior to a given prompt.
Quote:Original post by greencrayon
How do I distribute my games to my friends? Do I just send them the .exe file? Or is it more complicated than this? Please forgive my lack of knowledge, up until early this year I did not even know how to open a folder on my PC.
Again, assuming C++, yes all you need to do is send the exe. Your programs will not be cross platform however; if you make them in windows they will only playable on windows compatible computers.

I am so sorry, yes C++ is the language I am using. /blush
Thanks for the pointers guys, yes getline seems like just the thing I need. So I just send the exe? splendid /rubs hands together. They wont know what hit them.
Yup, for the console stuff it's mainly just going to be the *.exe. When you move onto bigger projects you may end up including dynamic link libraries (*.dll files) in your program which means you will also have to include them with the exe. And there is also, of course, storing your own data in files, i.e. maps, models, textures etc. You would need to include them with youe exe as well (unless you make them a party of your "resources" which means they will be embedded in the *.exe, but don't worry about that just yet).
Comrade, Listen! The Glorious Commonwealth's first Airship has been compromised! Who is the saboteur? Who can be saved? Uncover what the passengers are hiding and write the grisly conclusion of its final hours in an open-ended, player-driven adventure. Dziekujemy! -- Karaski: What Goes Up...

This topic is closed to new replies.

Advertisement