#include<stdio.h>
#define MAX 3
struct job
{
int at, bt, wt, tat, index;
};
void main()
{
struct job p[MAX], temp;
int i, j, clk, idl, ttat, twt;
clrscr();
for(i=0;i<MAX;i++)
{
printf("\nEnter AT : ");
scanf("%d",&p[i].at);
printf("\nEnter BT : ");
scanf("%d",&p[i].bt);
p[i].index=i+1;
}
printf("\nPro AT BT");
for(i=0;i<MAX;i++)
{
printf("\nP%d %d %d",p[i].index,p[i].at,p[i].bt);
}
for(i=0;i<MAX;i++)
{
for(j=i+1;j<MAX;j++)
{
if(p[i].at>p[j].at)
{
temp=p[j];
p[j]=p[i];
p[i]=temp;
}
}
}
printf("\nAfter sort\n");
printf("\nPro AT BT");
for(i=0;i<MAX;i++)
{
printf("\n%d %d %d",p[i].index,p[i].at,p[i].bt);
}
clk=0;
idl=0;
printf("\nGantt Chart : ");
printf(" %d ",clk);
for(i=0;i<MAX;i++)
{
if(clk<p[i].at)
{
idl+=p[i].at-clk;
clk=p[i].at;
printf("|/////| %d ",clk);
}
p[i].wt=clk-p[i].at;
clk=clk+p[i].bt;
p[i].tat=clk-p[i].at;
printf("| P%d | %d ",p[i].index,clk);
}
printf("\n\n\nAfter Exc\n");
printf("\nPro AT BT WT TAT");
for(i=0;i<MAX;i++)
{
printf("\n%d %d %d %d %d",p[i].index,p[i].at,p[i].bt,p[i].wt,p[i].tat);
}
getch();
}
nice posts..
ReplyDeleteHadoop training in hyderabad.All the basic and get the full knowledge of hadoop.Hadoop online training
With the technological advancements professionals and learners need to keep themselves updated and match the pace. For an example, sorting and tracking Big Data requires enough skilled man power.