:cry: i need a code for first come first serve simulation based on vb programming :rolleyes:

Hello,

This is the C++ forum; your request involves Visual Basic, and that is why I moved the post to that forum.

It is also the rule at DaniWeb that we do not do your homework; we will help debug your code, we will help you design your program, but we cannot supply you the completed project. That is unethical for you to ask, and unethical for us to provide.

Please provide your information, and we can get to work with you. As I am not a vb programmer, I will have little else to say.

Christian

:cry: i need a code for first come first serve simulation based on vb programming :rolleyes:

This sounds extraordinarily like homework. Why not post what you have already done and maybe we can help when it looks like you've had a try yourself.

Write down what you want the scenario to be -
For each person in the line,
serve first person only
next

Convert it to code

#include<stdio.h>
main()


    {
    float avgwt,avgtt;
    char pname[10][10],c[10][10];
    int wt[10],tt[10],bt[10],at[10],t,q,i,n,sum=0,sbt=0,ttime,j,ss=0;
    printf("\n\nEnter the number of processes:");
    scanf("%d",&n);
    printf("\n\n Enter the NAME, BURST TIME and ARRIVAL TIME of thr process");
    for(i=0;i<n;i++)


        {
        printf("\n\nNAME : ");
        scanf("%s",&pname[i]);
        printf("\n\nBURST TIME : ");
        scanf("%d",&bt[i]);
        printf("\n\n ARRIVAL TIME :");
        scanf("%d",&at[i]);
    }
    for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)


        {
        if(at[i]>at[j])


            {
            t=at[i];
            at[i]=at[j];
            at[j]=t;
            q=bt[i];
            bt[i]=bt[j];
            bt[j]=q;
            strcpy(c[i],pname[i]);
            strcpy(pname[i],pname[j]);
            strcpy(pname[j],c[i]);
        }
    }
    wt[0]=0;
    for(i=0;i<n;i++)


        {
        wt[i+1]=wt[i]+bt[i];
        sum=sum+(wt[i+1]-at[i]);
        tt[i]=wt[i]+bt[i];
        ss=ss+bt[i];
    }
    avgwt=(float) sum/n;
    avgtt=(float) sbt/n;
    printf("\n\nAverage waiting time=%f",avgwt);
    printf("\n\nAverage turn-around time=%f",avgtt);
    printf("\n\n GANTT CHART\n");
    for(i=0;i<n;i++)


        {printf("|\t%s\t",pname[i]);
    }
    printf("\n");
    for(i=0;i<n;i++)


        {
        printf("%d\t\t",wt[i]);
    }
    printf("%d\n",ss);
    printf("\n");
}
commented: 6 YEARS too late, in the wrong language and NO *!"? CODE TAGS -4

please post explanation about the code that you've shown/post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.