When you have default parameters in a function, you can't skip the first one without an error. You can however skip the others. Does anyone know why? I gave a short baby program to look at and move stuff around to see what I mean... If anyone knows I would appreciate the knowledge!
Thanks a bunch.
ex:
//Function Prototype
int volume(int length, int width = 5, int height = 2);
//Main Function
int main()
{
//Define Function Arguments
int l = 10;
int w = 15;
int h = 12;
//Function Calls
cout << "The volume is: " << volume(l,w,h)
//return
return 0;
}//End main()
//Function Implementation
int volume(int length, int width, int height)
{
cout << "The parameters are: " << length << " , " << width << " , " << height << endl;
return length * width * height;
}//End volume()
Thanks a bunch.
ex:
//Function Prototype
int volume(int length, int width = 5, int height = 2);
//Main Function
int main()
{
//Define Function Arguments
int l = 10;
int w = 15;
int h = 12;
//Function Calls
cout << "The volume is: " << volume(l,w,h)
//return
return 0;
}//End main()
//Function Implementation
int volume(int length, int width, int height)
{
cout << "The parameters are: " << length << " , " << width << " , " << height << endl;
return length * width * height;
}//End volume()