首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

简单化代码

2012-12-27 
简化代码typedef struct{//存Span里面的有颜色 无颜色 粗体等内容char* pcSpanColor[100]char* pcSpanNot

简化代码
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里面
[其他解释]
路过学习一下。

热点排行