Store Large Amounts of Text Into Variable

This is a discussion on Store Large Amounts of Text Into Variable within the C++ Programming forums, part of the General Programming Boards category; Hello I'm making a text-based adventure game with C++. It includes lots of random variables and cases, which is hard ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    1

    Store Large Amounts of Text Into Variable

    Hello

    I'm making a text-based adventure game with C++. It includes lots of random variables and cases, which is hard to keep track of. Is there any way that, instad of this:
    Code:
    if (e == 1)
    {action}
    else if (e == 2)
    {action 2}
    I could just type something like:
    Code:
    case1
    In other words, as the title says, can large amounts of text be stored to a variable? If so, how would I do it?

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Er, yes. That's what std::string is for.

    But somehow I don't think that's quite what you want. What you really want is a game engine and the ability to define the actual game data in data files. And that's a lot more complex.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 11:07 AM
  2. Replies: 1
    Last Post: 08-03-2005, 04:14 AM
  3. How do i store today's date in variable?
    By Brain Cell in forum C Programming
    Replies: 12
    Last Post: 08-23-2004, 06:24 AM
  4. store date in a variable
    By actionbasti in forum C++ Programming
    Replies: 2
    Last Post: 10-01-2003, 09:50 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21