something to make this easier...

Started by
25 comments, last by Kambiz 18 years ago
i know there is something to make this easier i just can't remember what it is or how to do it. I have a series of functions that i need to be operated multiple times. (C++) So i put them into something similar to a class and i just call that class everytime i wish to perform that series of functions. I can't remember what this is or the general syntax. If anyone could give me a brief description and tell me what it is i am thinking of i would really appreciate it. thanks
Advertisement
Why not just have all of your functions written out and then have one function that calls all the functions you want?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

see, im not sure exactly what you mean by that... can you explain and or give me an example?
It sounds like you a bit confused on terminology.

You don't "operate" functions. You call them. However, classes are templates for creating and using objects. You can't call classes.

Although from your post, it's not clear what you're trying to do, I'm going to guess you are trying to create a function to call several functions in succession. Here's how you would do that:

void FuncA(){    ...}void FuncB(){    ...}void FuncC(){}void CallAllFuncs(){    FuncA();    FuncB();    FuncC();}.... // later in your main or whereeverCallAllFuncs();


These functions can also take parameters and return values.
im not sure if this is exactly what i needed, but thanks and i will try.
ok another thing, i want to ad something to an int, and i can't get it to work properly..

its just,

if (blah){
+5 x;
}

and it won't work, i'm not sure if that is correct or not.

thanks
Quote:Original post by somebodys_life
ok another thing, i want to ad something to an int, and i can't get it to work properly..

its just,

if (blah){
+5 x;
}

and it won't work, i'm not sure if that is correct or not.

thanks

what language are you using? that's definitely not a C derivative language.

Beginner in Game Development?  Read here. And read here.

 

int A;A = 7; // int 'A' now holds '7'A += 5;  // int 'A' is now '13'A = A + 5; // int 'A' is now '18'A -= 2; // int 'A' is now '16'A = A - 2; // int 'A' is now '14'_________________________________int B;B = 5; //Sets 'B' as fiveB = A; //Sets 'B' to whatever 'A' isB += A; //Adds 'A' to 'B'B++; //Adds '1' to 'B'B--; //Subtracts '1' from 'B'B = B * B; //Multiplys 'B' times itselfA = B * B; //'A' now holds B sqared. (If 'B' is equal to '2', 'A' would now be '4' and 'B' would still be '2'



I think you want:

if(whatever){    x += 5;}


But I can't be sure unless I know what luagage you are using. (i.e. C, C++, Java, et c...)
it was stated above that i am using C++ (note first post)
Quote:Original post by somebodys_life
it was stated above that i am using C++ (note first post)

Then you want:

if(blah){
x += 5;
}

This topic is closed to new replies.

Advertisement