C program – Operator Precedence

by Nideesh C on April 17, 2011 · 0 comments

in C Programming




#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
void main()
 {
   int i=0,j=0,k=0,p[10];
   char name[20];
   char key[20]={'(',')','&','%','^','*','/','+','-','|',';'};
   clrscr();
   textcolor(2);
   cprintf("---Operator Precedence-----\n");
   cprintf("\nEnter the expression:");
   scanf("%s",&name);
   cprintf("\n---output----\n");
   for(i=0;i<20;i++)
   {
     for(j=0;j<strlen(name);j++)
     {
       char c;
       c=tolower(name[j]);
       if(!isalpha(c)&&!isdigit(c))
        {
          if(key[i]==c)
           {
             printf("\n %c is executed %d(%c %c %c)\n",c,k++,tolower(name[j-1]),c,tolower(name[j+1]));
           }
        }
     }
  }
 getch();
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program – Syntax Analyzer
  2. C++ program for overloading the unary operator ++.
  3. C Program to convert the lower case letters to upper case and vice-versa
  4. C++ program – Perform complex arithmetic using operator overloading
  5. C++ program – multiply two numbers without using multiplication operator

Leave a Comment

Previous post:

Next post: