下面是源码:
#pragma warning(disable:4996)
#include <iostream>
#include <string>
using namespace std;
string key[6] = { "begin", "if", "then", "while", "do", "end" };
//关键字
bool isKey(string str, int &syn) //判断是否为关键字,若是传回相应关键码的种别名
{
int i;
for (i = 0; i < 6; i++)
{
if (str == key[i])
{
syn = i + 1;
return true;
}
}
return false;
}
bool isLetter(char c) //是否为字母
{
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
return tru