I'm having a hard time with my code, can someone show me a fix? Here is my errors.

1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment 6.cpp.cpp(57) : error C2064: term does not evaluate to a function taking 2 arguments
1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment 6.cpp.cpp(62) : error C2064: term does not evaluate to a function taking 3 arguments
1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment 6.cpp.cpp(70) : error C2065: 'END' : undeclared identifier
1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment 6.cpp.cpp(70) : error C2146: syntax error : missing ';' before identifier 'LOOP'
1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment 6.cpp.cpp(70) : error C3861: 'LOOP': identifier not found
1>Build log was saved at "file://c:\Documents and Settings\Chuckie Taylor\My Documents\C++ Assignments\Assignment 6\Assignment 6.cpp\Assignment 6.cpp\Debug\BuildLog.htm"
1>Assignment 6.cpp - 5 error(s), 0 warning(s)

#include "stdafx.h"
#include <iostream> 
using namespace std; 

int area (int, int); // function prototype
int volume (int, int, int); // function prototype

int _tmain(int argc, _TCHAR* argv[])
{

	int length, width, depth; // parameters for the areas and volumes
	int area;
	int volume;
	int result;

	cout << endl;

	// read in the values of length, width, and depth

	while (depth == 0); 

	cout << "If you want the result of the calculation to be an area,";
	cout << endl;

	cout << "place a 0 in the depth parameter ";
	cout << endl << endl;

	cout << "Enter a length (postive integer): ";
	cin >> length;

	cout << "Enter a width (postive integer): ";
	cin >> width;

	cout << "Enter a depth (postive integer): ";
	cin >> depth;

	cout << endl;

	if (depth == 0) {
		result = area (length, width);
		cout << "With a length of " << length;
		cout << " and a width of " << width;
		cout << " the area is " << result << endl;
	} else {
		result = volume (length, width, depth);
		cout << "With a length of " << length;
		cout << " a width of " << width;
		cout << " and a depth of " << depth;
		cout << " the volume is " << result << endl;

	} // end if

	 END LOOP (depth == 0); 

		return 0;

} // end main function

int area (int l, int w) {
	
	int calculation;

	int area (l * w);

	return calculation;
	
} // end area function

int volume (int l, int w, int d) {

                int calculation;

                int volume (l * w * d);

	return volume;

} // end volume function

Recommended Answers

All 4 Replies

The first two are because you have local variables in main( ) with the same names as your functions - the compiler looks to the nearest defined name (the int's), which are not functions.

What are these lines supposed to be doing?

while (depth == 0);
END LOOP (depth == 0);

Ok I see get rid of the repeated int area; and int volume;.
The

while (depth == 0);

is a while/repeat loop so that it continues
until you want it to stop.

The

END LOOP (depth == 0);

is suppose to be the End of the loop structure. Any suggestions with this?

There is no ending item for a loop in c++. The loop executes a statement, or block of statements. Period.

while (something == true )   //no semicolon here
{
    //do statements here
}  //closing curly brace ends the loop block
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.