标签:des blog io os ar for sp div c
#include <iostream> using namespace std; char const *keyword[]={"do","for","switch","return","while"}; int lookup_keyword(const char * const des,char const *keyword_table[],int constsize) { const char **kwp; for (kwp=keyword_table;kwp<keyword_table+constsize;kwp++) { if (strcmp(*kwp,des)==0) { return kwp-keyword_table; } } return -1; } void main() { cout<<lookup_keyword("while",keyword,5); }
标签:des blog io os ar for sp div c
原文地址:http://www.cnblogs.com/mu-tou-man/p/4006758.html