Hello, i am hoping someone can help me with this code error. I am reading Sams Teach Yourself C++ in 21 days and i am using Dev C++ as the compiler. Right now i am stumped, I only have one error stopping me from compiling my program and running it. I have looked over the code in the book and have written it down exactly.
The error is: ISO C++ forbids declaration of 'VolumeCube' with no type.
And here is the code:
Code://demonstrates use of default parameter values #include <iostream> int VolumeCube(int length, int width = 25, int height = 1); int main() { int length = 100; int width = 50; int height = 2; int volume; volume = VolumeCube(length, width, height); std::cout << "First volume equals: " << volume << "\n"; volume = VolumeCube(length, width); std::cout << "Second time volume equals: " << volume << "\n"; volume = VolumeCube(length); std::cout << "Third time volume equals; " << volume << "\n"; return 0; } VolumeCube (int length, int width, int height) { return (length * width * height); }



LinkBack URL
About LinkBacks



