Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CRegKey::SetValue not function on Win 7 Pin
_Flaviu22-Aug-11 19:26
_Flaviu22-Aug-11 19:26 
QuestionVisual studio 2005 (package load failure) Pin
lahatra19-Aug-11 7:48
lahatra19-Aug-11 7:48 
AnswerRe: Visual studio 2005 (package load failure) Pin
Richard MacCutchan19-Aug-11 9:20
mveRichard MacCutchan19-Aug-11 9:20 
QuestionHow to detect a winsock connection lost Pin
sirtimid19-Aug-11 5:53
sirtimid19-Aug-11 5:53 
AnswerCrosspost Pin
Richard MacCutchan19-Aug-11 6:39
mveRichard MacCutchan19-Aug-11 6:39 
QuestionVc6 have problem on Win 7 Pin
_Flaviu19-Aug-11 5:29
_Flaviu19-Aug-11 5:29 
AnswerRe: Vc6 have problem on Win 7 Pin
User 742933820-Aug-11 21:16
professionalUser 742933820-Aug-11 21:16 
QuestionGhraphical representation of RR scheduling program Pin
coder 719-Aug-11 4:56
coder 719-Aug-11 4:56 
hello all, I have coded a round robin scheduling program using visual c++ , version 6.0. I want to add some simple graphics in my code so that a graphical representation of RR scheduling can be made. But, I don't know how to add graphics in visual c++. Can anyone of you give a suggestion or advice? Can you give me a sample code so that I can understand how to change my code to add graphics in it? Thanks.

Here is my code:

C#
#include<stdio.h>
#include<conio.h>
struct round{
    char name[20];
    int at,bt,wt,trn,prev,ord,rem,cp,q,tc;
 };
struct round Q[20],temp;
int main()
{
int f=0,r,i,j,k=0,n,q=0,exe=0,idle=0;
int tt=0,qt,wt=0,awt=0,flag=0,min=0;
float turn=0.0,wait=0.0;



printf("enter the number of process:");
scanf("%d",&n);
printf("enter the quantum:");
scanf("%d",&qt);
for(r=0;r<n;r++)
{
printf("\n Enter process name:");
scanf("%s",Q[r].name);

}
for(r=0;r<n;r++){
printf("\n Enter process %s arrival time:",Q[r].name);
scanf("%d",&Q[r].at);
}
for(r=0;r<n;r++){
printf("\n Enter process %s duration time:",Q[r].name);
scanf("%d",&Q[r].bt);
}
for(r=0;r<n;r++){
printf("\n Enter process %s order:",Q[r].name);
scanf("%d",&Q[r].ord);
}





for(i=0;i<n;i++){

    for(j=i+1;j<n;j++){

if(Q[i].ord>Q[j].ord)
{
    temp=Q[i];
    Q[i]=Q[j];
    Q[j]=temp;
}

    }
}
min=Q[0].at;
for(i=0;i<n;i++){
    if(min>Q[i].at){
         min=Q[i].at;

    }

}
for(i=0;i<n;i++){
        exe=exe+Q[i].bt;
        Q[i].cp=Q[i].at;
        Q[i].tc=Q[i].at;
        Q[r].wt=0;

    }

printf("\n sequence of job:");

if(min!=0){
    idle+=min;
}
while(tt<exe){

        for(i=0;i<n;i++){

            if((Q[i].tc<=tt)){
                if(Q[i].bt>qt){

                    flag=1;


                     Q[i].wt=tt-Q[i].prev-Q[i].cp;

                      awt=awt+Q[i].wt;
                      if((Q[i].wt!=0)&&(Q[i].prev==0)){
                        Q[i].q=Q[i].wt;
                    }

                     Q[i].bt=Q[i].bt-qt;
                     tt+=qt;

                     Q[i].prev=tt;

                     printf("%s ",Q[i].name);

             Q[i].cp=0;
             Q[i].tc=tt;


                }
                else
                {
                    if(Q[i].bt!=0){
                        flag=1;

                    Q[i].wt=tt-Q[i].prev-Q[i].cp;
                    awt=awt+Q[i].wt;

                    tt+=Q[i].bt;




                    Q[i].bt=0;
                    if((Q[i].wt!=0)&&(Q[i].prev==0)){
                        Q[i].q=Q[i].wt;
                    }
                     Q[i].prev=tt;
                    if(Q[i].bt==0){



                    Q[i].trn=tt-(Q[i].at+Q[i].q);


                        k+=Q[i].trn;



                    }

               printf("%s ",Q[i].name);

                    Q[i].cp=0;
                   Q[i].tc=tt;
                    }

                }


            }



        }
        if(flag==0){
            tt+=1;
            idle+=1;

        }
        flag=0;

    }
printf("\n Total Execution time:");
printf("%d",tt);
wait=(float)awt/n;
printf("\n Avarage Waiting time:");
printf("%.3f",wait);
printf("\n Avarage turnaround time:");
turn=(float)k/n;
printf("%.3f",turn);
printf("\n idle:%d",idle);
printf("\n");
return 0;
}

AnswerRe: Ghraphical representation of RR scheduling program Pin
Richard MacCutchan19-Aug-11 5:10
mveRichard MacCutchan19-Aug-11 5:10 
QuestionChanging Cursors Pin
softwaremonkey18-Aug-11 10:46
softwaremonkey18-Aug-11 10:46 
AnswerRe: Changing Cursors Pin
David Crow18-Aug-11 16:22
David Crow18-Aug-11 16:22 
GeneralRe: Changing Cursors Pin
softwaremonkey19-Aug-11 8:16
softwaremonkey19-Aug-11 8:16 
Questionplz brack my licence Pin
saqibali211918-Aug-11 8:11
saqibali211918-Aug-11 8:11 
AnswerCross-post Pin
Wendelius18-Aug-11 8:13
mentorWendelius18-Aug-11 8:13 
QuestionWhat does it mean to have a stale variable? Pin
AndrewG123118-Aug-11 8:01
AndrewG123118-Aug-11 8:01 
AnswerRe: What does it mean to have a stale variable? Pin
enhzflep18-Aug-11 8:09
enhzflep18-Aug-11 8:09 
GeneralRe: What does it mean to have a stale variable? Pin
AndrewG123118-Aug-11 8:36
AndrewG123118-Aug-11 8:36 
QuestionAdd .c file Pin
john563218-Aug-11 4:38
john563218-Aug-11 4:38 
AnswerRe: Add .c file Pin
Maximilien18-Aug-11 4:48
Maximilien18-Aug-11 4:48 
GeneralRe: Add .c file Pin
john563218-Aug-11 4:56
john563218-Aug-11 4:56 
GeneralRe: Add .c file Pin
Richard MacCutchan18-Aug-11 5:23
mveRichard MacCutchan18-Aug-11 5:23 
GeneralRe: Add .c file Pin
Maximilien18-Aug-11 5:26
Maximilien18-Aug-11 5:26 
GeneralRe: Add .c file Pin
«_Superman_»18-Aug-11 5:38
professional«_Superman_»18-Aug-11 5:38 
QuestionRe: Add .c file Pin
David Crow18-Aug-11 4:49
David Crow18-Aug-11 4:49 
AnswerRe: Add .c file Pin
JohnNawrocki23-Aug-11 4:40
JohnNawrocki23-Aug-11 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.