Hi,
I am trying to learn functions but the book I'm using places the arguments into the function 'manually', they are 'constants'.
I'm trying to pass the arguments to the function by using variables.
Here is my code:-
This isn't compiling, using Dev-C++ it is saying:-Code:#include <iostream> using namespace std; void box(int length, int width, int height); int main() { int length; int width; int height; cout << "Enter length of the box " << endl; cin >> length; cout << "Enter length of the box " << endl; cin >> width; cout << "Enter length of the box " << endl; cin >> height; box(); system("pause"); return 0; } void box(length, width, height) { cout << "The volume of the box is " << length * width * height << endl; }
Line 5 is-Line:5 "too few arguments to function `void box(int, int, int)'
I'm confused as this line is straight from the book.void box(int length, int width, int height);
Could anyone be so kind as to offer me some pointers?
Many thanks!