So after my previous post
http://www.lebgeeks.com/forums/viewtopic.php?id=11757
I tried to solve it, its not done yet but for some reason this is not working properly. Anyone have any idea? your help is much appreciated :)
Edited:
I just worked on it i think i'm done but still it stops working after input .
after editing..seriously now why won't it work
#include<stdio.h>
#include<string.h>
#include<conio.h>
#define N 10
void main(){
int n,at[N],bt[N],prty[N],i,j,k,counter;
char *pname[N], *A[N];
do{
printf("Enter the number of processes:");
scanf("%d",&n);
}while(n>100);
printf("Enter the following data:\n");
for(i=0;i<n;i++)
{ printf("\nProcess %d\n-------\nName:",i+1);
scanf("%s",&pname[i]);
printf("Arrival time:");
scanf("%d",&at[i]);
printf("Burst time:");
scanf("%d",&bt[i]);
printf("Priority:");
scanf("%d",&prty[i]);
}
for(i=0;i<n;i++)
{ counter=0;
if(prty[i]==0 || prty[i]==1 || prty[i]==2 || prty[i]==3 )
{for(j=i+1;j<=n;j++)
if(bt[i]<bt[j])
strcpy(A[i],pname[i]);
else
strcpy(A[i],pname[j]);
counter++;
}
else
continue;
}
for(i=counter;i<n;i++)
{ for(k=0;k<n;k++){
if(prty[k]==4 || prty[k]==5 || prty[k]==6 || prty[k]==6)
{
for(j=k+1;j<=n;j++)
if(at[k]<at[j])
strcpy(A[i],pname[k]);
}
}
}
for(i=0;i<n;i++)
printf("%s",A[i]);
getchar();
}