Hi all.
I have found some tutorials online, I believe they were from some university classes, and one from a guy named Juan Soulie.

I seem to have solved the bulk of my issues, yet have one last one-- that I can identify.

For some reason that I still don't understand, I keep getting a c2059 error, stating that return is a syntax error.

int main(void)
{
	do 
	{
cout << "         Copyright 2001, Welcome to the Angle Finder Program.          " << endl;
cout << "        This program is designed to take only numeric values.          " << endl;
cout << "       Make certain you only input numbers. Otherwise it will exit.    " << endl;
	cout << " Please choose:  1 for the Hip/Valley Angle. "         << endl;
	       cout << "                 2 for the Cricket Valley Angle. "     << endl;
	       cout << "                 3 for the Ridge Angle "               << endl;
	       cout << "                 0 to exit. "                        << endl;
		char ch;
		cin >> ch;
		
switch (ch)
{ 
     case '1' :  int HipValley(int& Rise1, int& Rise2, double& Eave, float& a); 
                    // this is the Hip/Valley choice.
	break;

     case '2' : int CricketValley(int& Rise1, int& Rise2, double& Eave, float& a, float& Width); 
                   // this is the cricket valley choice.
	break;

      case '3' : int RidgeAngle(int& Rise1, int& Rise2); // this is the Ridge Angle choice.
               break;
      default : return 0; // this will end the routine.
 }  while (ch != 27);
        }
return 0; //line 186

}

This is the error:

e:\..folder path.....\steveangle.cpp(186) : error C2059: syntax

I've checked my '{' braces, and everything else seems to work, but it keeps calling this error.

Recommended Answers

All 3 Replies

I think it was your do-while loop. Maybe the program misinterpreted the return 0 and was looking for a while loop. Consider your code--

int main(void)
{
	do 
	{
		cout << "         Copyright 2001, Welcome to the Angle Finder Program.          " << endl;
		cout << "        This program is designed to take only numeric values.          " << endl;
		cout << "       Make certain you only input numbers. Otherwise it will exit.    " << endl;
		cout << " Please choose:  1 for the Hip/Valley Angle. "         << endl;
		cout << "                 2 for the Cricket Valley Angle. "     << endl;
		cout << "                 3 for the Ridge Angle "               << endl;
		cout << "                 0 to exit. "                        << endl;
		char ch;
		cin >> ch;

		switch (ch)
		{ 
			case '1' :      
					int HipValley(int& Rise1, int& Rise2, double& Eave, float& a); 
					// this is the Hip/Valley choice.
				break;

			case '2' :      
					int CricketValley(int& Rise1, int& Rise2, double& Eave, float& a, float& Width); 
					// this is the cricket valley choice.
				break;

			case '3' : 	
					int RidgeAngle(int& Rise1, int& Rise2); // this is the Ridge Angle choice.
				break;
				
			default : 
				return 0; // this will end the routine.
				
		} while (ch != 27); //while loops after switch statement
	} //no while loop here, where program expects it
	
	return 0; //line 186
}

Try this --

int main(void)
{
	do 
	{
		cout << "         Copyright 2001, Welcome to the Angle Finder Program.          " << endl;
		cout << "        This program is designed to take only numeric values.          " << endl;
		cout << "       Make certain you only input numbers. Otherwise it will exit.    " << endl;
		cout << " Please choose:  1 for the Hip/Valley Angle. "         << endl;
		cout << "                 2 for the Cricket Valley Angle. "     << endl;
		cout << "                 3 for the Ridge Angle "               << endl;
		cout << "                 0 to exit. "                        << endl;
		char ch;
		cin >> ch;

		switch (ch)
		{ 
			case '1' :      
					int HipValley(int& Rise1, int& Rise2, double& Eave, float& a); 
					// this is the Hip/Valley choice.
				break;

			case '2' :      
					int CricketValley(int& Rise1, int& Rise2, double& Eave, float& a, float& Width); 
					// this is the cricket valley choice.
				break;

			case '3' : 	
					int RidgeAngle(int& Rise1, int& Rise2); // this is the Ridge Angle choice.
				break;
				
			default : 
				return 0; // this will end the routine.
				
		} 
	}while (ch != 27); //now should be a functional do-while loop
	
	return 0; //line 186
}

Well because your indentation sucks, it's impossible for you to tell that the
while (ch != 27);
is stuck on the closing brace of the switch, and not the closing brace of the do

Well because your indentation sucks, it's impossible for you to tell that the
while (ch != 27);
is stuck on the closing brace of the switch, and not the closing brace of the do

Salem,
Thanks.
I don't know why my indentation got so screwed up.
It looked fine when I posted.
After I posted, I dug more, and realized that it was the placement of my while statement. I'd had it one brace too deep.
This portion is now resolved.
Thanks for your posts.

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.