Question about C and C++

This is a discussion on Question about C and C++ within the C++ Programming forums, part of the General Programming Boards category; I have a question in computer programming why do we use variables in our command's is it to assing a ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    32
    I have a question in computer programming why do we use variables in our command's is it to assing a object a name used to store in memory? I have been going over c++ 7 times I could make a calculator on the computer and make it work. but I don't understand game programming on how everything is put together, like what are variables used in games what's it's job and alo array's and how can I create my own functions? If anyone could clearify this It would be apprechiated. Thanks for your time. And their is no advantage on C script c++ is more widely used in commerical games or programs I also suggest to learn .LUA scripting it's used mostly in EA games, I mean you need to learn c++ before you cna learn .LUA scripting.

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    That's a lot of questions...

    You'll be able to answer lots of them by working your way through the tutorials. And, it would be easier to answer the remaining questions when you understand the basic stuff in the tutorials.

    A variable can represent any number of things. It might be a simple bool-type variable that represents if a game-character is dead or alive. Or, it could represent the location of something on the screen. In a game program, a character is probably a C++ object which has many variables contained in it. The object will also have functions in it that allow it to "do stuff", or so you can do stuff to it. (These functions are called member functions or methods.)

    The simplest use of an array is for a character array... a word or sentence... A single variable can only represent a single ASCII alpha-numeric character. If you want to hold more than one character, you need an array of variables. (C++ can use a character array or a string object to hold a string.)

    I'm not actually familiar with the particular scripts that you mention. But generally a script is interpreted (converted to machine language) at run-time. This is much slower than a compiled language like C or C++, which is converted to machine language (an EXE file) in advance.

    Another thing that is surprising to most beginners is that there are no graphics, color, mouse, or sound in ANSI/ISO standard C++. Most programmers spend six months to a year learning standard-portable C++ before moving-on to system-specific stuff with graphics. The tutorials are a good start, but if you wan't to really learn C++, you'll need a book, or two, or three, or...

    FYI- Commercial games are complicated. They usually have several man-years of programming in them. So, you can't write a commercial-quality game by yourself.
    Last edited by DougDbug; 03-20-2006 at 07:24 PM.

  3. #3
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    I've done some scripting before, and there's no point learning it till you're proficient in c++. Easy langauges like BASIC, scripts, java (hehe) can all be picked up in a matter of a week. The foundation matters. Once you have that, you might want to check out
    libsdl.org

    It's easy, portable, and covers alot of ground

Popular pages Recent additions subscribe to a feed

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