Hey I've written a program that prompts the user to enter sides and the program figures out what kind of triangle the sides equal. I keep getting some retarted error saying "3 triangleCalc.cpp `triangleType' does not name a type ". It's also saying " 1 Taxes\triangleCalc.cpp header.h: No such file or directory." This is the coding that I have.


header.h

#ifndef header_h
#define header_h

#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <cctype>
#include <cstdlib>
#include <fstream>


using namespace std;

namespace triangles
{
enum triangleType {scalene, isosceles, equilateral, noTriangle}; // declares the different types of triangles
}
using namespace triangles;
	//List of the different functions
	
void extern displayRedo ();
triangleType extern triangleShape (int side1, int side2, int side3);
void extern displayShape (triangleType triangle);
void extern displaySides (int side1, int side2, int side3);
void extern displayInsuranceCheck ();

int extern getSide1 ();
int extern getSide2 ();
int extern getSide3 ();

void extern askSide1 ();
void extern askSide2 ();
void extern askSide3 ();
void extern displayUsage ();
void extern displayPurpose ();
char extern getAnswer ();

void extern myLabel ( const char * assignment, const char * date,
               ostream & out);
#endif

heading

#include "header.h"

using namespace std;

void myLabel (/* in */ const char * assignment, const char * date,
              /* inout */ ostream & out)
{

   out << "\n\n\t\t" << setfill('*') << setw(45) << '*'
       << "\n\t\t" << setfill(' ') << setw(5) << left << '*'
       << setw(35) << assignment << right << setw(5) <<'*'
       << "\n\t\t" << setw(5) << left << '*'
       << setw(35) << "Computer Programming II" << right << setw(5) <<'*'
       << "\n\t\t" << setw(5) << left << '*'
       << setw(35) << "Creator: Aaron Rosen" << right << setw(5) <<'*'
       << "\n\t\t" << setw(5) << left << '*' << "Due Date: "
       << setw(25) << date << right << setw(5) <<'*'
       << "\n\t\t" << setfill('*') << setw(45) << '*' << setfill(' ') << endl;
}

input

#include "header.h"

char getAnswer () // answer to question so it can continue 
{
	char answer;
		
		do
		{
		cin >> answer;
		answer = toupper (answer);
		cout << " ";
		void Flush ();
		}
		while (answer != 'Y' && answer != 'N');

	return (answer);
}

int getSide1 ()
{
	int side1;
      	do
          {     
		askSide1 ();
		cin >> side1;
		void Flush ();
}       while ( side1 <= 0 );
		return side1;
}

int getSide2 ()
{
	int side2;
        do 
        {
		askSide2 ();
		cin >> side2;
		void Flush ();
}       while ( side2 <= 0 );
		return side2;
}

int getSide3 ()
{
	int side3;
        do
        {
		askSide3 ();
		cin >> side3;
		void Flush ();
}       while ( side3 <= 0 );
		return side3;
}

#include "header.h"

int main ()
{

	char response;
	char Answer2; 

				{displayPurpose ();} //shows what the program does

			{do
			{
				
				triangleType triangle; //makes the enum for different triangles
                
				int side1; // sides 1, 2, 3 can be used for project
				int side2;
				int side3;
			do
			{
				side1 = 0; // 1,2,3 are set to = 0 just in case...
				side2 = 0; 
				side3 = 0;
				
				side1 = getSide1 ();
				side2 = getSide2 ();
				side3 = getSide3 ();
				displaySides (side1, side2, side3);

			}
			while (response == 'Y');

				triangle = triangleShape (side1, side2, side3); // figures out what the shape is
				displayShape (triangle);

				displayRedo ();
				Answer2 = getAnswer ();
			}
			while (Answer2 == 'Y');
}
    myLabel ("Triangles 2.0", "02/20/2008", cout);
    system("PAUSE");
    return EXIT_SUCCESS;

output

#include "header.h"

void displayPurpose ()
{
	cout << "\nThis program lets you know if the sides you give " << endl;
	cout << "can form a triangle." << endl;
	cout << "These are triangles that can be calculated by the computer " << endl;
	cout << "\nScalene" << endl;
	cout << "None of the sides are the same." << endl;
	cout << "Isosceles" << endl;
	cout << "2 of the sides are the same." << endl;
	cout << "Equilateral" << endl;
	cout << "All of the sides are the same." << endl;
	cout << "\nTo get this program started, you must enter the lengths of the triangle." << endl;
	cout << "\nDo not enter negative integers or the program will have errors!!!" <<endl;
}

void askSide1 ()
{
	cout << "Enter an amount for the length of side 1. " << endl;

}

void askSide2 ()
{
	cout << "Enter an amount for the length of side 2. " << endl;

}

void askSide3 ()
{
	cout << "Enter an amount for the length of side 3. " << endl;

}

void displaySides (int sideA, int sideB, int sideC)
{
	cout << "\n-These are the sides that you inputted-" << endl;
	cout << "\nSide 1: " << sideA << endl;
	cout << "Side 2: " << sideB << endl;
	cout << "Side 3: " << sideC << endl;

}


void displayShape (triangleType triangle) // prints the determined shape.
	{
    switch (triangle) 
		{
		case noTriangle:
        cout << "\nThe sides given DO NOT form a triangle." << endl;
        break;
		case equilateral:
        cout << "\nAll of the sides are equivalent. " << endl;
		cout << "The lengths given form an EQUILATERAL TRIANGLE." << endl;
        break;
		case isosceles:
        cout << "\nAt least two of the sides given are equivalent" << endl;
		cout << "and thus form an ISOSCELES TRIANGLE." << endl;
        break;
		case scalene:
        cout << "\nNone of the sides are equivelant to another side, " << endl;
		cout << "but the lengths given still form a triangle." << endl;
        cout << "All of the sides make a SCALENE TRIANGLE." << endl;
		break;
		}
	}

void displayRedo ()
{
	cout << "\nWould you like to use this program again? Y/N ";

}

triangleCalc

#include "header.h"

triangleType triangleShape(int sideA, int sideB, int sideC) //recieve sides from main
 {
    triangleType shape; //initialize shape
           
            if (sideA == 0 || sideB == 0 || sideC == 0)
               shape = noTriangle;
               else if (sideA != sideB && sideA == sideC && sideB != sideC)
                 shape = scalene;
                 else if (sideA == sideB && sideA == sideC)
                 shape = equilateral;
                 else if (sideB == sideC)
                 shape = isosceles;
                 else if (sideA == sideC)
                 shape = isosceles; 
                 else if (sideA == sideB)
                 shape = isosceles; 
                 
                 return shape;
}

In case you haven't noticed these are supposed to be seperate files.
If anyone figures out this stupid problem it'd be much appreciated.

Ok sorry about that I had to clean up my post a little bit. Just read this one instead please:
Hey I've written a program that prompts the user to enter sides for a triangle and the program figures out what kind of triangle the sides equal. I can get the program to run just fine. The only problem is that it doensn't say what type of triangle it is!!! If anyone can figure out why please let me know!! This is the program

header.h

#include <cmath>
#include <iostream>
#include <string>
#include <cctype>
#include <cstdlib>
#include <fstream>


using namespace std;

namespace triangles
{
enum triangleType {scalene, isosceles, equilateral, noTriangle}; // declares the different types of triangles
}
using namespace triangles;
	//List of the different functions
	
void extern displayRedo ();
triangleType extern triangleShape (int side1, int side2, int side3);
void extern displayShape (triangleType triangle);
void extern displaySides (int side1, int side2, int side3);
void extern displayInsuranceCheck ();

int extern getSide1 ();
int extern getSide2 ();
int extern getSide3 ();

void extern askSide1 ();
void extern askSide2 ();
void extern askSide3 ();
void extern displayUsage ();
void extern displayPurpose ();
char extern getAnswer ();

void extern myLabel ( const char * assignment, const char * date,
               ostream & out);
#endif

heading

#include "header.h"

using namespace std;

void myLabel (/* in */ const char * assignment, const char * date,
              /* inout */ ostream & out)
{

   out << "\n\n\t\t" << setfill('*') << setw(45) << '*'
       << "\n\t\t" << setfill(' ') << setw(5) << left << '*'
       << setw(35) << assignment << right << setw(5) <<'*'
       << "\n\t\t" << setw(5) << left << '*'
       << setw(35) << "Computer Programming II" << right << setw(5) <<'*'
       << "\n\t\t" << setw(5) << left << '*'
       << setw(35) << "Creator: Aaron Rosen" << right << setw(5) <<'*'
       << "\n\t\t" << setw(5) << left << '*' << "Due Date: "
       << setw(25) << date << right << setw(5) <<'*'
       << "\n\t\t" << setfill('*') << setw(45) << '*' << setfill(' ') << endl;
}

input

#include "header.h"

char getAnswer () // answer to question so it can continue 
{
	char answer;
		
		do
		{
		cin >> answer;
		answer = toupper (answer);
		cout << " ";
		void Flush ();
		}
		while (answer != 'Y' && answer != 'N');

	return (answer);
}

int getSide1 ()
{
	int side1;
      	do
          {     
		askSide1 ();
		cin >> side1;
		void Flush ();
}       while ( side1 <= 0 );
		return side1;
}

int getSide2 ()
{
	int side2;
        do 
        {
		askSide2 ();
		cin >> side2;
		void Flush ();
}       while ( side2 <= 0 );
		return side2;
}

int getSide3 ()
{
	int side3;
        do
        {
		askSide3 ();
		cin >> side3;
		void Flush ();
}       while ( side3 <= 0 );
		return side3;
}

main

#include "header.h"

int main ()
{

	char response;
	char Answer2; 

				{displayPurpose ();} //shows what the program does

			{do
			{
				
				triangleType triangle; //makes the enum for different triangles
                
				int side1; // sides 1, 2, 3 can be used for project
				int side2;
				int side3;
			do
			{
				side1 = 0; // 1,2,3 are set to = 0 just in case...
				side2 = 0; 
				side3 = 0;
				
				side1 = getSide1 ();
				side2 = getSide2 ();
				side3 = getSide3 ();
				displaySides (side1, side2, side3);

			}
			while (response == 'Y');

				triangle = triangleShape (side1, side2, side3); // figures out what the shape is
				displayShape (triangle);

				displayRedo ();
				Answer2 = getAnswer ();
			}
			while (Answer2 == 'Y');
}
    myLabel ("Triangles 2.0", "02/20/2008", cout);
    system("PAUSE");
    return EXIT_SUCCESS;
}

output

#include "header.h"

#include "header.h"


void displayPurpose ()
{
	cout << "\nThis program lets you know if the sides you give " << endl;
	cout << "can form a triangle." << endl;
	cout << "These are triangles that can be calculated by the computer " << endl;
	cout << "\nScalene" << endl;
	cout << "None of the sides are the same." << endl;
	cout << "Isosceles" << endl;
	cout << "2 of the sides are the same." << endl;
	cout << "Equilateral" << endl;
	cout << "All of the sides are the same." << endl;
	cout << "\nTo get this program started, you must enter the lengths of the triangle." << endl;
	cout << "\nDo not enter negative integers or the program will have errors!!!" <<endl;
}

void askSide1 ()
{
	cout << "Enter an amount for the length of side 1. " << endl;

}

void askSide2 ()
{
	cout << "Enter an amount for the length of side 2. " << endl;

}

void askSide3 ()
{
	cout << "Enter an amount for the length of side 3. " << endl;

}

void displaySides (int sideA, int sideB, int sideC)
{
	cout << "\n-These are the sides that you inputted-" << endl;
	cout << "\nSide 1: " << sideA << endl;
	cout << "Side 2: " << sideB << endl;
	cout << "Side 3: " << sideC << endl;

}


void displayShape (triangleType triangle) // prints the determined shape.
	{
    switch (triangle) 
		{
		case noTriangle:
        cout << "\nThe sides given DO NOT form a triangle." << endl;
        break;
		case equilateral:
        cout << "\nAll of the sides are equivalent. " << endl;
		cout << "The lengths given form an EQUILATERAL TRIANGLE." << endl;
        break;
		case isosceles:
        cout << "\nAt least two of the sides given are equivalent" << endl;
		cout << "and thus form an ISOSCELES TRIANGLE." << endl;
        break;
		case scalene:
        cout << "\nNone of the sides are equivelant to another side, " << endl;
		cout << "but the lengths given still form a triangle." << endl;
        cout << "All of the sides make a SCALENE TRIANGLE." << endl;
		break;
		}
	}

void displayRedo ()
{
	cout << "\nWould you like to use this program again? Y/N ";

}

triangleCalc

#include "header.h"

triangleType triangleShape (int side1, int side2, int side3) //recieve sides from main
 {
    triangleType shape; //initialize shape
           
            if (side1 == 0 || side2 == 0 || side3 == 0)
               shape = noTriangle;
               else if (side1 != side2 && side1 == side3 && side2 != side3)
                 shape = scalene;
                 else if (side1 == side2 && side1 == side3)
                 shape = equilateral;
                 else if (side2 == side3)
                 shape = isosceles;
                 else if (side1 == side3)
                 shape = isosceles; 
                 else if (side1 == side2)
                 shape = isosceles; 
                 
                 return shape;
}

In case you haven't noticed these are supposed to be seperate files.
It seems to realize what an equilateral triangle is but if you enter a '0' u can keep entering it as many times as you want. Besides that, it won't recognize what other triangles are. Anyone who helps it's appreciated!!!

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.