Mystic

So has anyone got any mystik news ?

random pic:

image: CPPV2cover

#include <iostream>

int AreaCube(int length, int width = 25, int height = 1);

int main()
{
int length = 100;
int width = 50;
int height = 2;
int area;

area = AreaCube(length, width, height);
std::cout << "First area equals: " << area << "\n";

area = AreaCube(length, width);
std::cout << "Second time area equals: " << area << "\n";

area = AreaCube(length);
std::cout << "Third time area equals: " << area << "\n";

char response;
std::cin >> response;
return 0;
}

int AreaCube(int length, int width, int height)
{

return (length * width * height);
}

what is its output? first one gets a nekid pic of loekino!
Comments
24
hes pregnant
plz, enough about Mystic now? Every fuckin day a new journal about him... If you miss him so badly, buy a ticket to finland and search him, ask him then. Dont bother us with your gerk-off fantasy ....

bb
ure just frustrated becouse noone likes/cares u and everybody cares about mystic, np, no need to reply we all know that im right.
Parent
More gibri news please
mAus is new mystic!
Lepari is the new Squall? :<
Parent
post the pic of loekino
10.000 :p

i'm not a programmer or even trying 2
compiler error tbh!

unless you've overloaded the AreaCube() method.
Jeez, C++ is weird when you've only had Java. :<

From what I remember from Java this won't work. First you set the integer AreaCube() and give it the values "length, width = 25, height = 1", and later on you create the same integer again without values. Unless you give length, width and hight a value outside of the integer it should give an error.

Could be wrong though, don't know how C++ compares to Java n aLL. :<
16 years old and already working on this useless stuff ? NAIIZZ :'(
Parent
Blame school lohLZ.
Parent
well c++ differs a bit, java is more fun , java > c++!!! , this shit compiles, well the first AreaCube is the prototype, where you set the values with = 25 and = 1 those are only used if you do not set the values.
Parent
Aha. So main() basically returns 0 as it says "return 0", and AreaCube() basically returns lenght * 25 * 1? ;O)
Parent
nope, it returns the 3 areacube functions in the main() return 0 doesnt do anything , its jsut somethign you put into every c++ code
Parent
I guess I'll stick to Java. :<
Parent
return 0 ends the function by returning false.
Parent
It's very easy.
First area = 10000 (100 * 50 * 2)
Second area = 5000 (100 * 50 *1)
Third area = 2500 (100 * 25 * 1)

It's good example of how default values of parameters work. When you call AreaCube with 3 parameters default values are not used. However, if you provide less than 3 parameters, compiler will assume that remaining parameters are set to values specified in function prototype, in 2nd line (right after #include).

And no, "return 0" is not something you put in every c++ code. It's statement that ends current function with 0 (integer) as result. If this is last function (read: it's main(), called right after starting application) then value you're returning there will go to your OS / environment to determine if app stopped running due to some error / bug / problem or was just closed.
0 determinates that there were no errors.
First area equals: 10000
Second time area equals: 5000
Third time area equals: 2500
who kares
Back to top