读书人

简单化代码

发布时间: 2012-12-27 10:17:10 作者: rapoo

简化代码
typedef struct
{
//存Span里面的有颜色 无颜色 粗体等内容
char* pcSpanColor[100];
char* pcSpanNotColor[20];
char* pcSpanCenter[20];
char* pcSpanIndent[30];
char* pcSpanBold[100];

//存Para里面的有颜色 无颜色 粗体等内容
char* pcPColor[100];
char* pcPNotColor[20];
char* pcPCenter[20];
char* pcPIndent[30];
char* pcPBold[100];
}SHtmlHead;
SHtmlHead SHtmlHeadInfo;
存Span内容的指针数组变量
int ihecl = 0;
int inotcl = 0;
int icenter = 0;
int iinde = 0;
int iBold =0;
存Para内容的指针数组变量
int iPhecl = 0;
int iPnotcl = 0;
int iPcenter = 0;
int iPinde = 0;
int iPBold =0;

这样定义和操作 感觉很繁琐,有没有好的方法,如何简化?
[最优解释]
先定义一个struct style {
char* pcSpanColor[100];
char* pcSpanNotColor[20];
char* pcSpanCenter[20];
char* pcSpanIndent[30];
char* pcSpanBold[100];
};
然后把他放到header里面
[其他解释]

引用:
先定义一个struct style {
char* pcSpanColor[100];
char* pcSpanNotColor[20];
char* pcSpanCenter[20];
char* pcSpanIndent[30];
char* pcSpanBold[100];
};
然后把他放到header里面

+1
5个int也可以放到struct里面
[其他解释]
路过学习一下。

读书人网 >VC/MFC

热点推荐