2013年11月11日

摘要: #include #include #include using namespace std;int a[60];struct linkque{ int data; linkque* link;};void main(){ linkque *first=new linkque; linkque *que; linkque *current=first; srand((unsigned)time(NULL)); first->data=rand()%1000; first->link=NULL; for (int i=0;idata=rand... 阅读全文
posted @ 2013-11-11 20:53 xds1224 阅读(714) 评论(0) 推荐(0) 编辑

2013年11月10日

摘要: 看了孙鑫老师的vc++深入详解中的利用两个newbutton的交替出现来实现逃跑按钮,自己也来写一个只利用一个newbutton实现能在对话框中随机跑的逃跑按钮首先,新建一个MFC基于对话框的应用程序,在资源窗口中,将按钮和菜单全部删除,在对话框中添加一个button,就是我们要进行追踪的按钮,将他的caption改为“你能抓到我吗?”如图所示,按照书上所讲述的步骤,接下来我们就要自定义一个CButton的派生类,名叫CNewbutton,之后将这个类与我们的这个按钮相关联。我们现在在我们的主对话框类中,建立一个CNewbutton的成员变量,将其与这个“你能抓到我吗”的按钮ID相关联。代码体 阅读全文
posted @ 2013-11-10 17:54 xds1224 阅读(600) 评论(0) 推荐(0) 编辑

2013年11月7日

摘要: 数字化图像是一个m×m 的像素矩阵。在单色图像中,每个像素的值要么为0,要么为1,值为0的像素表示图像的背景,而值为1的像素则表示图元上的一个点,我们称其为图元像素。如果一个像素在另一个像素的左侧、上部、右侧或下部,则称这两个像素为相邻像素。识别图元就是对图元像素进行标记,当且仅当两个像素属于同一图元时,它们的标号相同。queue.h-----------------------------#includestruct location{ int x; int y;};struct Node{ location data; Node* t; };class Linked... 阅读全文
posted @ 2013-11-07 23:15 xds1224 阅读(287) 评论(0) 推荐(0) 编辑

2013年11月6日

摘要: queue.h-------------#includestruct location{ int x; int y;};struct Node{ location data; Node* t; };class LinkedQueue { // FIFO对象public: LinkedQueue() {front = rear = NULL;} // 构造函数 ~LinkedQueue(); // 析构函数 bool IsEmpty() const {return ((front) ? false : true);} //locatio... 阅读全文
posted @ 2013-11-06 22:30 xds1224 阅读(335) 评论(0) 推荐(0) 编辑
摘要: stack.h------------------------------------------------#includestruct locate{ int x; int y;};class stacknode{ friend class stack;public: locate t; stacknode* link;};class stack{public: stack(); bool isempty(){return (top==NULL);} void insert(locate x); bool pop(locate& x); bool gettop(locate& 阅读全文
posted @ 2013-11-06 22:28 xds1224 阅读(273) 评论(0) 推荐(0) 编辑
摘要: #include #includeusing namespace std;int main(){cout>m>>n;clock_t start,finish;start=clock();int **a=new int *[m];for (int i=0;i=col1;i--) { a[row2][i]=num; num++; } row2--; situ=3; break;case 3:for (int i=row2;i>=row1;i--){a[i][col1]=num;num++;} col1++; situ=0; break;default:break;}}for 阅读全文
posted @ 2013-11-06 22:20 xds1224 阅读(200) 评论(0) 推荐(0) 编辑

导航