It's a program that works sort of like a lexical analyzer, but it's just supposed to pull any given data from a .txt file and display it. Nothing else. I'm not satisfied with the array I have so far.
/****************************************************************
Array holding all keywords for checking.
*****************************************************************/
char
*keywords[]={"procedure","is","begin","end","var","cin","cout","if",
"then","else","and","or","not","loop","exit","when",
"while","until"};
/****************************************************************
Array holding all arithmetic operations for checking.
*****************************************************************/
char arithmetic_operator[]={'+','-','*','/'};
/****************************************************************
Array holding all comparison operations for checking.
*****************************************************************/
char *comparison_operator[]={"<",">","=","<=","<>",">="};
/****************************************************************
Array holding all special for checking.
*****************************************************************/
char special[]={'%','!','@','~','$'};
I didn't know how to create an array that will just pull anything from any given text file, so that's why it checks for different things. How can I create such an array? The input files look similar to this one:
class A {
int a[11],x,y,z;
char *oneString;
public:
A() { oneString= new char[100]; }
A() { delete oneString; }
void f();
};
void A::f() {
int temp;
x=y+1;
z=x+2; z= x*x;
}