2 qyy2014 QYY2014 于 2016.03.04 22:19 提问

一个关于C++源程序关键字统计的问题
c++

为什么是char类型
char KeyWord[Total][MaxLength]是什么意思

const int Total=63; //
const int MaxLength=20;

char KeyWords[Total][MaxLength] //列举关键字
{
"asm","auto","bool","break","case",
"catch","char","class","const","const_cast",
"continue","default","delete","do","double",
"dynamic_cast","else","enum","explicit","export",
"extern","false","float","for","friend",
"goto","if","inline","int","long",
"mutable","namespace","new","operator","private",
"protected","public","register","reinteroret_cast","return",
"short","signed","sizeof","static","static_cast",
"struct","switch","template","this","throw",
"true","try","typedef","typeid","typename",
"union","unsigned","using","virtual","void",
"volatile","wchar_t","while",
};

1个回答

u013596119
u013596119   Rxr 2016.03.04 22:26
已采纳

你把char [Total][MaxLenght]想成string [Total]就行了,这个二维数组,每一行是一个char数组,就是一个string,每一行的每一列都是一个字母,
比如第一行是'a','s','m',第二行是'a','u','t','o',一共63行,也就是63个关键字,每个关键字最长20个字符

QYY2014
QYY2014 谢谢
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!