//-------------------------------------------------------------------- // // Laboratory 5 (In-lab 3 shell) delim.cs // // Program validates delimiter pairing. // //-------------------------------------------------------------------- #include //#include "stackarr.cpp" #include "stacklnk.cpp" //-------------------------------------------------------------------- // // Function prototype bool delimitersOk ( const string &expression ); //-------------------------------------------------------------------- void main() { string inputLine; // Input line char ch; // Holding pen for input chars cout << "This program checks for properly matched delimiters." << endl; while( cin ) { cout << "Enter delimited expression ( to quit) : " << endl; // Read in one line inputLine = ""; cin.get(ch); while( cin && ch != '\n' ) { inputLine = inputLine + ch; cin.get(ch); } if( ! cin ) // Reached EOF: stop processing break; if ( delimitersOk (inputLine) ) cout << "Valid" << endl; else cout << "Invalid" << endl; } } // Insert your delimitersOk function below