Question: A c++ program for one of my classes starts with Initalizing a table of rules vector M[3][5]; I am not familliar with this syntax. Is
A c++ program for one of my classes starts with Initalizing a table of rules
vector
I am not familliar with this syntax. Is it a vector containing arrays? if so how do I place and retrieve values using this table.
If it isnt, what is this syntax referring to and how do I use it?
if it helps here is the template for the program.
vector
void readrules() { ifstream fin ("rules", ios::in); // ** read in the rules info M, make sure $ is not stored // ** display the table
}
void addtostack(vector
int main() { readrules();
string ss; cout << "Enter a string made of 0's and/or 1's: "; cin >> ss;
// ** push 'S' onto the stack to start cout << "Stack"; // ** display the stack vertically
int i = 0; while (ss[i] != '\0') // for each char of ss { // ** based on the current character, update the stack // ** note that mismatches will cause immediate failure }
// ** check for success for failure based on stack empty or not
}
where the rules are S 0 A 0 $ S 1 A 1 $ A 0 0 $ A 1 1 $
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
