📜  中缀 c 程序的后缀 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:21.359000             🧑  作者: Mango

代码示例1
#include
int main()
{
    char str[100],oprator[100],operant[100];
    int i ,opr=-1,op=-1;
    printf("enter the string");
    scanf("%s",str);
    for (i=0;str[i]!=NULL;i++)
    {
        if(str[i]=='+'||str[i]=='-'||str[i]=='*'||str[i]=='^'||str[i]=='/')
        {
        (opr)++;
            oprator[opr]=str[i];
        }
        else
        {
            (op)++;
            operant[op]=str[i];
        }
        
    }
     printf("operator are:\n");
     for (i=0;i<=opr;i++)
     printf("%c",oprator[i]);
     printf("\noperandas are:\n");
    for (i=0;i<=op;i++)
    printf("%c",operant[i]);
    return 0;
}