ti.settime() 必须带参数。。还有,类结束以后必须有};
class time {
int hour,minute,second;
public;
time(int h=0,int m=0,int s=0)
{hour=h;minute=m,second=s;}
void set-time(int h,int m,int s)
{hour=h;minute=m,second=s;}
void show( )
{cout
time t1( );
time t2( );
t1,show( );
t2,show( );
t1,set time (12,43,34 );
};
这样就好了吧。不过有点小白了。。。
#include
using namespace std;
class CPoint
{
private:
int x;
int y;
public:
void CPoint()
{
x=60;y=75;
}
void display()
{
cout
cout
}
void setPoint(int a,int b)
{
x=a;
y=b;
}
};
int main()
{
CPoint a;
a.display();
a.setPoint(80,150);
a.display();
return 0;
}
void CDemoDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
RECT rect={0,400,200,20};
::DrawText (dc.m_hDC,"大方广:", -1,&rect,DT_SINGLELINE | DT_LEFT | DT_VCENTER |DT_END_ELLIPSIS ) ;
RECT rect1={0,440,400,20};
::DrawText (dc.m_hDC,"其身正,不令而行,其身不正,虽令不从", -1,&rect1,DT_SINGLELINE | DT_LEFT | DT_VCENTER |DT_END_ELLIPSIS ) ;
RECT rect2={0,480,200,20};
::DrawText (dc.m_hDC,"行有不得,反诸己", -1,&rect2,DT_SINGLELINE | DT_LEFT | DT_VCENTER |DT_END_ELLIPSIS ) ;
}
以上是简单vc程序设计的详细内容。更多信息请关注PHP中文网其他相关文章!