A题笔记(13)

Evaluate Reverse Polish Notation

Reverse Words in a String

类似的,需要将原序列后序排列的时候,都可以用 栈 来实现

    stack<int> tmp;      //创建
    b=tmp.top();         //返回栈顶元素,但不删除
    tmp.pop();           //出栈但不返回元素
    tmp.push(b);         //推B入栈
    tmp.size();          //栈中元素个数    
    tmp.empty();         //若栈空,返回true

string 中

    s.clear();                //清空string
    cin>>s;                  //送输入流读取字符串【以空白字符结束】
    getline(cin, s);           //从输入流中读入一行字符【可以有空白字符】
    s.substr(iFind, iFindend-iFind); 
    iFind=s.find_first_not_of(arg);  //第一个不属于arg中的字符的位置
    iFind=s.find_last_of(arg);     //查找arg中任意字符最后一次出现的位置
原文地址:https://www.cnblogs.com/LeoGodfrey/p/3590535.html