3-6 infix expression converted to suffix expression

Source: Internet
Author: User
Tags cmath

1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \VC\INCLUDE\XTGMATH.H (214): Warning C4602: #pragma pop_macro: "New" The identifier is not preceded by a #pragma push_macro
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \VC\INCLUDE\XTGMATH.H (215): Warning C4193: #pragma warning (POP): No matching " #pragma warning (push) "
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \VC\INCLUDE\XTGMATH.H (216): Warning C4161: #pragma pack (pop ...): The stack is more than the stack
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath (All): Error C2061: syntax error: identifier "ABS"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2059: syntax error: ";"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2061: syntax error: identifier "ACOs"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2061: syntax error: identifier "ASIN"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2061: syntax error: identifier "Atan"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2059: syntax error: ";"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2061: syntax error: identifier "ATAN2"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2061: syntax error: identifier "Ceil"
1>e:\ Speed Koala Download catalog \vs2013 (Visual Studio 2013 Ultimate) \vc\include\cmath: Error C2061: syntax error: identifier "cos"

The above error may occur if the switch word is incorrectly written.

Input 1:

2+3* (7-4) +8/4# Input 2: ((2+3) *4-(8+2))/5#
1#include <iostream>2#include <cctype>3#include <stack>4 using namespacestd;5 6 intGetPriority (Charch)7 {8     intPriority =0;9     Switch(CH)Ten     { One          Case '+': APriority =1; -              Break; -          Case '-': thePriority =1; -              Break; -          Case '*': -Priority =2; +              Break; -          Case '/': +Priority =2; A              Break; at          Case '(': -Priority =3; -              Break; -         default: -Priority =0; -              Break; in     } -     returnPriority ; to } +  -  the intMain () * { $std::stack<Char>S;Panax Notoginseng     Charch; -CIN >>ch; the      while(ch! ='#') +     { A          while(IsDigit (CH)) the         { +cout <<ch; -CIN >>ch; $             if(!isdigit (CH))//CH is not a number and is not ' # ', indicating that an input to an integer data is completed and a space is printed $cout <<" "; -              -  the         } -         if(ch = ='#')Wuyi              Break; the         if(ch = =')')//if the read-in character is ') ', then the top element of the stack is output -         { Wu              while(S.top ()! ='(') -             { Aboutcout << s.top () <<" "; $ S.pop (); -             } - S.pop (); -         } A         Else     //in normal case, the CH and stack top characters are compared priority +         { the              while(! S.empty () && s.top ()! ='('&& getpriority (S.top ()) >=getpriority (CH)) -             { $cout << s.top () <<" " ; the S.pop (); the             } the s.push (CH); the  -}cin >>ch; in     } the  the      while(!s.empty ()) About     { thecout <<s.top (); the S.pop (); the         if(!s.empty ()) +cout <<" "; -     } the Bayi     return 0; the}

3-6 infix expression converted to suffix expression

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.