All pastes #452326 Raw Edit

Stuff

public cpp v1 · immutable
·published 2007-04-22 05:31 UTC
rendered paste body
#include <iostream>#include <string>#include <list>using namespace std;int main(){	list<char> stack;	list<char>::iterator c;	string data;	cout << "Please enter a mathematical equation: ";	getline(cin, data);	cout << "Length: " << data.length() << endl << endl;	for (int i = 0; i < data.length(); i++)	{		char current = data[i];		switch (current)		{			case '(':				stack.push_front(data[i]);			case ')':			case '[':				stack.push_front(data[i]);			case ']':			case '{':				stack.push_front(data[i]);			case '}':			default:			break;		}	}        for (c = stack.begin(); c != stack.end(); c++)                cout << "Stack Contents: " << *c << endl;        cout << endl;				//stack.push_front(data.substr(i, 1));		//cout << "Front of stack: " << stack.front() << endl;		//cout << "i: " << i << endl;	return 0;}