I am writing a code that draws 4 triangles. I keep geeting code C2562 'Triangles::drawTriangles' : 'void' function retruning a value. PLease help. I am using Visual C++ 2008 Express Edition SP1
// Member-function definitions for class Triangles that draws triangles.
#include <iostream>
using std::cout;
using std::endl;
// include definition of class Triangles from Triangles.h
#include "Triangles.h"
// function to draw triangles
void Triangles::drawTriangles()
{
// Variable declarations (no other variables are needed)
int row; // the row position
int column; // the column position
int space; // number of spaces to print
// first triangle
/*write a for header to interate column from 1 to 10 */
for (int column = 1; column <= 10; column++)
{
/*write a header ti interate column 1 to row*/
for (int column = 1; row <= 10; column++)
cout << "*";
cout << endl;
} //end for
cout << endl;
// second triangle
/*write a for header to iterate row from 10 down to 1 */
for (int row = 10; row >=1; row++)
{
/*write a for header to iterate column from 1 to row */
for (int column = 1; row <=10; column++)
cout << "*";
cout << endl;
} // end for
cout << endl;
// third triangle
/* write a for header to iterate row from 10 down to 1 */
for (int row = 10; row >=1; row--)
{
/*write a for header to iterate space from 10 down to one more than row */
for (int space =10; row >=1; space++)
cout << "*";
cout << endl;
} // end for
cout << endl;
// fourth triangle
/*write a for header to iterate row from 10 down to 1 */
for (int row = 10; row >=1; row++)
{
/*write a header to iterate space from 1 to one less than row */
for (int space =1; row <=10; row--)
cout << "*";
/* write a for header to iterate column from 10 down to row */
for (int column =10; row >=1; column++)
cout << "*";
cout << endl;
} // end for
return 0; // program terminated successfully
} // end function drawTriangles
Error 1 error C2562: 'Triangles::drawTriangles' : 'void' function returning a value c:\documents and settings\regina\my documents\visual studio 2008\projects\project 5 program 4\project 5 program 4\tuckerr_assign5prog4_triangles.cpp 76
I tried the [exit 0] and got the following errors:
Error 1 error C2143: syntax error : missing ';' before 'constant' c:\documents and settings\regina\my documents\visual studio 2008\projects\project 5 program 4\project 5 program 4\tuckerr_assign5prog4_triangles.cpp 76
Warning 2 warning C4551: function call missing argument list c:\documents and settings\regina\my documents\visual studio 2008\projects\project 5 program 4\project 5 program 4\tuckerr_assign5prog4_triangles.cpp 76