Posts

Open

Sri Siddhartha Institute of Technology  
Good morning friends  

OS

  Hello 👋 

Trash

 https://drive.google.com/file/d/1oOCGMLuMfnjgvk6YYVhDAMUDaMT4XJBl/view?usp=drivesdk

5.

 #include<stdio.h> #include<conio.h> #include<process.h> #define MAX_SIZE 4 int Q[MAX_SIZE], f = -1, r = -1; void main() { int ch,x; void QINSERT(int); void QDELETE(); void QDISPLAY(); while(1)  { clrscr(); printf("\n 1.insert \n 2.delete \n 3.display \n 4.exit \n\n enter your choice \n\n"); scanf("%d",&ch); switch(ch) { case 1: printf("\n enter the element to be inserted into the queue \n\n"); scanf("%d",&x); QINSERT(x); break; case 2: QDELETE(); break; case 3: QDISPLAY(); break; case 4: printf("\n Bye!!! See you later \n"); getch(); exit(0); default: printf("\n Invalid choice... try again \n"); } /* end of switch */  printf("\n\n press any key to continue........\n");  getch();  } /* end of while */ } /* end of main */ void QINSERT(int x) { if(r>=MAX_SIZE-1) { printf("\n queue overflow, insertion not possible \n"); return; } r++; Q[r]=x; if(f = = -1) f = 0; printf("\n ele...

4

 #include<stdio.h> #include<conio.h> #include<ctype.h> #include<process.h> #define MAX_SIZE 25 int s[MAX_SIZE],top=-1; char expr[25]; void main() { void PUSH(int); int POP(); int i=0,op1,op2,op3; clrscr(); printf("\n enter a valid postfix expression \n\n"); gets(expr); while(expr[i]!='\0') { if(isdigit(expr[i])) PUSH(expr[i]-'0'); else { op2=POP(); op1=POP(); switch(expr[i]) { case '+':op3=op1+op2; break; case '-':op3=op1-op2; break; case '*':op3=op1*op2; break; case '/':op3=op1/op2; break; default: printf("\n invalid operator %c \n",expr[i]); getch(); exit(0); } PUSH(op3); } i++; } if(top>0) printf("\n invalid input expression %s \n",expr); else printf("\n the result of the expression %s is %d \n",expr,s[top]); getch(); } void PUSH(int x) { if(top>=MAX_SIZE-1) { printf("\n stack overflow \n"); getch(); exit(0); } s[++top]=x; } int POP() { if(top==-1) { printf...