Homework 3 - Stacks

Due: Friday October 5, 2007 at 5pm

For this assignment, you will implement the linked node template class version of the Stack class. To test your implementation, your main program will check a C/C++ source file to see if it has matching parentheses and curly brackets. To do this, you will use stacks to hold the opening characters and match them to the closing characters. Your main program should prompt the user for a filename, open that file and read it in. Parse each character in the file looking for the opening and closing characters. If the parentheses and curly brackets all match, print out that the file is correct. Otherwise, print out if there are too many opening parentheses, too many closing parentheses, too many opening curly brackets or too many closing curly brackets. Your program should then loop back and ask for another filename. Exit when the user enters a blank filename.