📄 dlg.h
字号:
// DLG.h : main header file for the DLG application
//
#if !defined(AFX_DLG_H__31BEEAA9_2D5E_47E6_87A0_9C1C66919208__INCLUDED_)
#define AFX_DLG_H__31BEEAA9_2D5E_47E6_87A0_9C1C66919208__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CDLGApp:
// See DLG.cpp for the implementation of this class
//
class CDLGApp : public CWinApp
{
public:
CDLGApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDLGApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CDLGApp)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#define MAX 20
#define msgLEN 128
#define codeLEN 256
class Mapping
{
private:
int key[MAX];
int value[MAX];
int num;
public:
Mapping() {
num = 0;
}
int getCurrentKey() {return key[num-1];}
int getCurrentValue() {return value[num-1];}
int getKey(int i) {
if (i < 0 || i >= num) {
return -1;
}
return key[i];
}
BOOL setKey(int i, int pos) {
if (i < 0 || i >= num) {
return FALSE;
}
key[i] = pos;
return TRUE;
}
int getValue(int i) {
if (i < 0 || i >= num) {
return -1;
}
return value[i];
}
int Count() {return num;}
BOOL add(int k, int v) {
if (num < MAX) {
key[num] = k;
value[num++] = v;
return TRUE;
}
return FALSE;
}
BOOL remove() {
if (num > 0) {
num--;
return TRUE;
}
return FALSE;
}
// remove key-value pair according to the index
BOOL remove(int index) {
if (index < 0 || index >= num) {
return FALSE;
}else {
num--;
while (index < num) {
key[index] = key[index+1];
value[index] = value[index+1];
index++;
}
return TRUE;
}
}
// According to the key, then find and delete the key-value pair
BOOL del(int k) {
if (num > 0) {
int i = num;
while (i-- > 0) {
if (key[i] == k) {
return remove(i);
}
}
}
return FALSE;
}
BOOL exist(int k) {
int i = num;
while (i-- > 0) {
if (k == key[i])
return TRUE;
}
return FALSE;
}
void clear() {
num = 0;
}
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLG_H__31BEEAA9_2D5E_47E6_87A0_9C1C66919208__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -