这个程序编译出现1个错误,错在哪里了?
请教 下面这个程序编译出现1个错误,错在哪里了?c:\c++800\circle4.cpp(21) : error C2059: syntax error : ')'#include <iostream.h>
class CCircle
{
public:
CCircle(int r);
void Set(int r);
void Set(int r,int c);
int Get(void);
void DisplayArea(void);
~CCircle();
int m_Color;
private:
float CalculateArea(void);
int m_R;
};
CCircle::CCircle(int r)
{
m_R=r;
m_Color=();
}
CCircle::~CCircle()
{
}
void CCircle::DisplayArea(void)
{
float fArea;
fArea=CalculateArea();
cout<<"The area of the circle is:"<<fArea<<endl;
}
float CCircle::CalculateArea(void)
{
float f;
f=3.14*m_R*m_R;
return f;
}
void CCircle::Set(int r)
{
m_R=r;
m_Color=255;
}
void CCircle::Set(int r,int c)
{
m_R=r;
m_Color=c;
}
CCircle::Get(void) //
{
return m_R;
}
void main()
{
CCircle Mycircle(10);
cout<<"The m_R is:\n"<<Mycircle.Get()<<"\n";
cout<<"The m_Color is:\n"<<Mycircle.m_Color;
cout<<"\n";
Mycircle.Set(20);
cout<<"The m_R is:\n"<<Mycircle.Get()<<"\n";
cout<<"The m_Color is:\n"<<Mycircle.m_Color;
cout<<"\n";
Mycircle.Set(40,100);
cout<<"The m_R is:\n"<<Mycircle.Get()<<"\n";
cout<<"The m_Color is:\n"<<Mycircle.m_Color;
cout<<"\n";
}
Compiling...
circle4.cpp
c:\c++800\circle4.cpp(21) : error C2059: syntax error : ')'
c:\c++800\circle4.cpp(39) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
Error executing cl.exe.
circle4.obj - 1 error(s), 1 warning(s)