i got some enum error cant find solution
i tried retype the program that draw circle from the book beginner to c++ in 3 weeks
but i cant get it to work, i have check from my code and the books code but i cant find the error the kompilator keep coming back to enum here is the kods
Code:
#include <iostream>
using namespace std;
enum CHOICE { DrawRect = 1, GetArea, 3: GetPerim,
ChangeDimensions, Quit};
// Deklaration av klassen Rectangel
class Rectangle
{
public:
//kontruerare
Rectangle(int width, int height);
~Rectangle();
//atkomster metoder
int GetHeight() const { return itsHeight;}
int GetWidth() const { return itsWidth;}
int GetArea() const { return itsHeight * itsWidth;}
int GetPerim() const { return 2 * itsHeight + 2 * itsWidth;}
void SetSize(int newWidth, int newHeight);
//div.metoder
private:
int itsWidth;
int itsHeight;
};
//Implementreing av klass metoder
void Rectangle::SetSize(int newWidth, int newHeight)
{
itsWidth = newWidth;
itsHeight = newHeight;
}
Rectangle::Rectangle(int width, int height)
{
itsWidth = width;
itsHeight = height;
}
Rectangle::~Rectangle() {}
int DoMenu();
void DoDrawRect(Rectangle);
void DoGetArea(Rectangle);
void DoGetPerim(Rectangle);
int main()
{
//initiera en rectangle till 30
Rectangle theRect(30,5);
int choice = DrawRect;
int fQuit = false;
while (!fQuit)
{
choice = DoMenu();
if (choice < DrawRect || choice > Quit)
{
cout << "\nOgiltig val, forsok igen. \n\n";
continue;
}
switch (choice)
{
case DrawRect:
DoDrawRect(theRect);
break;
case GetArea:
DoGetArea(theRect);
break;
case GetPerim:
DoGetPerim(theRect);
break;
case ChangeDimension:
int newLength, newWidth;
cout <<"\nNy bredd: ";
cin >> newWidth;
cout << "Ny Hojd: ";
cin >> newLength;
theRect.SetSize(newWidth, newLength);
DoDrawRect(theRect);
break;
case Quit:
fQuit = true;
cout << "\nAvslutar...\n\n";
break;
default:
cout << "Fel i val\n";
fQuit = true;
break;
} // end switch
} // end while
return 0;
} // end main
int DoMenu()
{
int choice;
cout << "\n\n*******Meny*****\n";
cout << "(1) Rita rektangeln\n";
cout << "(2) Area\n";
cout << "(3) Omkrets\n";
cout << "(4) Andra Storlek\n";
cout << "(5) Avslutar\n";
cin >> choice;
return choice;
}
void DoDrawRect(Rectangle theRect)
{
int height = theRect.GetHeight();
int width = theRect.GetWidth();
for (int i = 0; i<height; i++)
{
for(int j=0; j<width; j++)
cout << "*";
cout << "\n";
}
}
void DoGetArea(Rectangle theRect)
{
cout << "Area: " << theRect.GetArea() << endl;
}
void DoGetPerim(Rectangle theRect)
{
cout << "Omkrets: " << theRect.GetPerim() << endl;
}