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 );
};
VC程式設計
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;
VC寫一個應用程式
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 ) ;
#########################'2B ###RECT rect2={0,480,200,20};### ###::DrawText (dc.m_hDC,"行有不得,反諸己", -1,&rect2,DT_SINGLELINE | DT_LEFT | DT_VCENTER |DT_END_ELLIPSIS ) ;### ###}###以上是簡單vc程式設計的詳細內容。更多資訊請關注PHP中文網其他相關文章!