#include<stdio.h>
#include<conio.h>
void main() { double p[3]; double c=1; int k,j,res,res1,i,now,now1,con; clrscr(); for(i=0;i<3;i++) { p[i]=0; } printf("\nWhich process do you want to start?\n"); k=0; printf("p[%d] OR p[%d] OR p[%d]",k,k+1,k+2); printf("\nenter the process no.(0/1/2):\n"); scanf("%d",&j); p[j]=0.5; c=c-p[j]; printf("\nDoes process C(controller)invokes any other process:\nFor Yes-Press 1\nFor No-press 0\n"); scanf("%d",&res); if(res==1) { printf("\nWhich process will it invoke(1 OR 2):\n"); scanf("%d",&now); p[now]=0.25; c=c-0.25; } printf("\nDoes process C(controller)invokes any other process:\nFor Yes-Press 1\nFor No-press 0\n"); scanf("%d",&res1); if(res1==1) { printf("\nWill it invoke(1 OR 2):\n"); p[now1]=0.25; c=c-0.25; } for(i=0;i<3;i++) { printf("\nIs Process p[%d] is completed:?\nfor yes-press 1\nfor No-press 0\n",i); scanf("%d",&con); if(con==1) { c=c+p[i]; } } if(c==1) { printf("\nAll Processes are COMPLETED"); } else { printf("\nSome PROCESS is NOT Complete"); } getch(); }
OUTPUT-
These blogs are quite incredible that have provided the best knowledge.
ReplyDeletetutorial for c++