Assignment #5
50 points (15 points off for each class meeting
late)
Due 04/21/2020
I have written a
program to check if a string represents a valid identifier. I need two function from you. The two functions are as follow.
int GetCategory(char c);
This
function returns
1 if c is _
2 if c is between a and z
3 if c is between A and Z
4 if c is between 0 and 9
5 otherwise
int NextState(int CurrState, int
Category, int &Length);
• This
function returns state according to the following table.
• This
function also increments parameter Length by 1 each time it is called.
curr \
state \ Category
1 2
3 4 5
|------------------------------------
0 | 1
1 1 2
2
1 | 1
1 1 1
2
2 |
2 2 2
2 2
You will put the
codes in subs.cpp, and the prototype in subs.h.
The main line is included as A05_main.cpp.
In every program file
(.cpp and .h) you turn in, use comment lines to show the following:
//Your name
//Section
//Assignment number
In the first three
lines of the output, print your name, section, and assignment number. For example:
John Smith
Section 0112
Assignment #3
Get Free Quote!
313 Experts Online