int main(int argc, char *argv[])
{
	vector<string> sVec;
	sVec.push_back("2");
	sVec.push_back("1");
	sVec.push_back("+");
	sVec.push_back("3");
	sVec.push_back("*");
	Solution so;
	std::cout << so.evalRPN(sVec) << std::endl;
	sVec.clear();
	sVec.push_back("4");
	sVec.push_back("13");
	sVec.push_back("5");
	sVec.push_back("/");
	sVec.push_back("+");
	std::cout << so.evalRPN(sVec) << std::endl;
	sVec.clear();
	sVec.push_back("-1");
	sVec.push_back("1");
	sVec.push_back("*");
	sVec.push_back("-1");
	sVec.push_back("+");
	std::cout << so.evalRPN(sVec) << std::endl;
	return 0;
}
int main()
{
    Solution s;
    char exps[5][3] = {"42", "9", "6", "-", "+"};
    vector<string> expression;

    cout << "Expression: \n    ";
    for (int i=0; i<5; i++) {
        expression.push_back(exps[i]);
        cout << exps[i] << " ";
    }
    cout << endl;
    cout << s.evalRPN(expression)<<endl;;

    char exps2[5][3] =  {"2", "1", "+", "3", "*"};
    expression.clear();

    cout << "Expression: \n    ";
    for (int i=0; i<5; i++) {
        expression.push_back(exps2[i]);
        cout << exps2[i] << " ";
    }
    cout << endl;
    cout << s.evalRPN(expression)<<endl;



    return 0;
}
int main()
{
	Solution s;
	vector<string> t1 = { "2", "1", "+", "3", "*" };
	cout << s.evalRPN(t1) << endl;
	vector<string> t2 = { "4", "13", "5", "/", "+" };
	cout << s.evalRPN(t2) << endl;
	return 0;
}
int main(){
	Solution s;
	string a[]={"2", "1", "+", "3", "*"};
	int na=Size(a);
	vector<string> tokena(a,a+na);
	cout<<s.evalRPN(tokena)<<endl;
	string b[]={"4", "13", "5", "/", "+"};
    int nb=Size(b);
    vector<string> tokenb(b,b+nb);
    cout<<s.evalRPN(tokenb)<<endl;
	string c[]={"10","6","9","3","+","-11","*","/","*","17","+","5","+"};
    int nc=Size(c);
    vector<string> tokenc(c,c+nc);
    cout<<s.evalRPN(tokenc)<<endl;
}
int main(int argc, char const *argv[])
{
	vector<string> tokens={"4", "13", "5", "/", "+"};
	Solution so;
	cout<<so.evalRPN(tokens)<<endl;
	return 0;
}
Example #6
0
int main(){
  vector <string> s = {"0","3","/"};
  int result;
  Solution *p = new Solution();
  result = p->evalRPN(s);
  cout << result << endl;
}
int main() {
    const struct {
        int            n;
        vector<string> tokens;
        int            expected;
    } CASES[] = {
        { 1, { "2", "1", "+", "3", "*" }, 9 },
        { 2, { "4", "13", "5", "/", "+" }, 6 },
        { 3, { "1", "3", "-" }, -2 },
        { 4, { "3", "1", "/" }, 3 },
        { 5, { "2", "1", "+", "4", "-" }, -1 },
    };
    int NUM_CASES = sizeof(CASES) / sizeof(CASES[0]);
    for (int i = 0; i < NUM_CASES; ++i) {
        int                   n        = CASES[i].n;
        const vector<string>& tokens   = CASES[i].tokens;
        int                   expected = CASES[i].expected;
        cout << "Test case " << n << " ... ";
        Solution s;
        int result = s.evalRPN(tokens);
        if (result == expected) {
            cout << "PASS";
        }
        else {
            cout << "FAIL (Expect " << expected << " but got " << result << ")";
        }
        cout << endl;
    }
    return 0;
}
Example #8
0
int main(void) {
	string s[] = { "4", "13", "5", "/", "+" };
	vector<string> v(s, s + 5);
	Solution so;
	cout << so.evalRPN(v) << endl;
	return 0;
}
int main()
{
	char * words[] = {"4", "13", "5", "/", "+"};
	Solution sol;
	vector<string> token(words,words + sizeof(words)/sizeof(char *));
	cout<<sol.evalRPN(token)<<endl;
	return 0;
}
int main() {
    vector<string> v;
    v.push_back("0");
    v.push_back("-4");
    v.push_back("+");
    Solution s;
    cout << s.evalRPN(v) << endl;
}
int main(int argc, char const *argv[])
{
	vector<string> tokens{"2", "1", "+", "3", "*"};
	Solution sl;
	int res = sl.evalRPN(tokens);
	cout<<"res is "<<res<<endl;
	return 0;
}
int main() {
    //vs test {"2", "1", "+", "3", "*"};    
    vs test {"4", "13", "5", "/", "+"};    
    Solution sol;

    cout << sol.evalRPN(test) << endl;
    return 0;
}
Example #13
0
int main(int argc, char **argv)
{
  string arr[5] = {"2", "1", "+", "3", "*"};
  vector<string> vec(arr + 0, arr + 5);

  Solution s;
  cout << s.evalRPN(vec) << endl;
}
int main(int argc, char* argv[])
{
    string arr[] = {"4", "13", "5", "/", "+"};
    vector<string> vec(arr, arr+sizeof(arr)/sizeof(arr[0]));
    Solution sln;
    int result = sln.evalRPN(vec);
    return 0;
}
int main(int argc, const char *argv[]) {
    vector<string> test;
    test.push_back("0");
    test.push_back("3");
    test.push_back("/");
    Solution s;
    std::cout << s.evalRPN(test) << std::endl;
    return 0;
}
Example #16
0
int main() {
    string a[] = {
        "2", "1", "+", "3", "*"
    };
    vector<string> v(a, a+sizeof(a)/sizeof(a[0]));
    Solution sol;
    cout << sol.evalRPN(v) << endl;
    return 0;
}
int main(int argc, char *argv[]) {
	Solution *s = new Solution;
	vector<string> t;
	t.push_back("3");
	t.push_back("-4");
	t.push_back("+");
//	t.push_back("/");
//	t.push_back("+");
	cout << s->evalRPN(t) << endl;
}
Example #18
0
int main(int argc, char const *argv[])
{
	Solution *s = new Solution();
	string str1[] = {"2", "1", "+", "3", "*"};
	string str2[] = {"4", "13", "5", "/", "+"};
	vector<string> test1(str1, str1 + 5);
	vector<string> test2(str2, str2 + 5);
	cout<<s->evalRPN(test1)<<endl;
	cout<<s->evalRPN(test2)<<endl;
	return 0;
}
int main(int argc, char const *argv[])
{
	

  //["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
  //["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
	Solution s;
	std::vector<string> v = {"4", "13", "5", "/", "+"};
	cout << s.evalRPN(v);
	return 0;
}
Example #20
0
int main(){
	vector<string> v;
	v.push_back("3");
	v.push_back("-4");
	v.push_back("+");

	Solution s;
	int r=s.evalRPN(v);
	cout << r << endl;
	return 0;
}
int main()
{
    Solution s;
	vector<string> tokens;
	tokens.push_back("5");
	tokens.push_back("-1");
	tokens.push_back("+");
	cout << s.evalRPN(tokens) << endl;
    
    return 0;
}
Example #22
0
int main()
{
	Solution st;
	vector<string> thisTokens;
	thisTokens.push_back("2");
	thisTokens.push_back("1");
	thisTokens.push_back("+");
	thisTokens.push_back("3");
	thisTokens.push_back("*");
	cout << st.evalRPN(thisTokens); 
	return 0;
}
void test(string intokens[] , int n, int ret )
{
	Solution so;
	vector<string> tokens(intokens,intokens + n);
	cout<<"vector size = "<<tokens.size()<<endl;
	//cout<<tokens[3]<<endl;
	if(ret == so.evalRPN(tokens))
	{
		printf("------------------------------pass\n");
	}
	else
	{
		printf("------------------------------failed!!!\n");
	}
}
int main()
{
        vector<string> str;
        str.push_back(string("48"));
        str.push_back(string("12"));
        str.push_back(string("12"));
        str.push_back(string("+"));
        str.push_back(string("/"));
        
        
        Solution s;
        int r = s.evalRPN(str);
        cout << r << endl;
        return 0;
}
int main()
{
    vector<string> tokens(5);
    tokens[0] = "2";
    tokens[1] = "1";
    tokens[2] = "+";
    tokens[3] = "3";
    tokens[4] = "*";

    Solution solu;
    int result = solu.evalRPN(tokens);

    cout << result << endl;

    return 0;
}
Example #26
0
int main()
{
    vector<string> data;
    data.push_back("-5");
    data.push_back("1");
    data.push_back("2");
    data.push_back("+");
    data.push_back("4");
    data.push_back("*");
    data.push_back("+");
    data.push_back("3");
    data.push_back("/");
    Solution* solver = new Solution();
    std::cout << solver->evalRPN(data) << std::endl;
    std::cout << "Hello world" << std::endl;
    return 0;
}
Example #27
0
//test
int main()
{
	vector<string> str;
	str.push_back("3");
	str.push_back("1");
	str.push_back("2");
	str.push_back("+");
	str.push_back("*");
	str.push_back("2");
	str.push_back("1");
	str.push_back("+");
	str.push_back("3");
	str.push_back("*");
	str.push_back("+");
	Solution sol;
	cout << sol.evalRPN(str) << endl;
}
Example #28
0
int main()
{
	Solution sol;
	vector<string> exp;
	exp.push_back("10");
	exp.push_back("6");
	exp.push_back("9");
	exp.push_back("3");
	exp.push_back("+");
	exp.push_back("-11");
	exp.push_back("*");
	exp.push_back("/");
	exp.push_back("*");
	exp.push_back("17");
	exp.push_back("+");
	exp.push_back("5");
	exp.push_back("*");
	int result = sol.evalRPN(exp);
	cout<<result<<endl;
	return 0;
}
int main()
{
	Solution s;
	vector<string> tokens{"4", "13", "5", "/", "+"};
	cout << s.evalRPN(tokens) <<endl;
}