QYY2014
扫地僧与茶
采纳率100%
2016-03-04 14:19

一个关于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 u52983610 5年前

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

    点赞 评论 复制链接分享