gun.cpp
来自「实现了汉诺塔的程序设计」· C++ 代码 · 共 75 行
CPP
75 行
// gun.cpp: implementation of the gun class.
//////
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "hanot.h"
#include "gun.h"
#include "hanotDlg.h"
#include "iostream.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
gun::~gun()
{
}
gun::gunshow(int zuobiao_x,int zuobiao_y,CImageList* I_list,CDC* XX)
{
int i;
CPoint pt(zuobiao_x,zuobiao_y);
for(i=1;i<17;i++)
{
(*I_list).Draw(XX,pan_bianhao[i],pt,ILD_NORMAL);
pt.y-=8;
}
}
gun::get_ceng()
{
return ceng;
}
gun::set_pan_bianhao(int x,int y)
{
pan_bianhao[x]=y;
}
gun::set_ceng(int input_ceng)
{
ceng=input_ceng;
}
gun::get_pan_bianhao(int y)
{
return pan_bianhao[y];
}
gun::SET_gun(int x,int temp_ceng)
{
int i;
ceng=temp_ceng;
pan_bianhao[0]=17;
if(x==0)
{
for(i=1;i<temp_ceng+1;i++)
{
pan_bianhao[i]=temp_ceng+1-i;
}
for(i=temp_ceng+1;i<17;i++)
{
pan_bianhao[i]=0;
}
}
else
{
for(i=1;i<17;i++)
{
pan_bianhao[i]=0;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?