| | |
Need Help..!!
![]() |
•
•
Join Date: Dec 2008
Posts: 1
Reputation:
Solved Threads: 0
Hi Everyone..!!
I'm a newcomer here. And looks like need your help here. I 've just make a program tha simulates The HRN CPU Scheduler.I have no problem in compiling it. But, when I run it, It won't work.
I don't know which Part of my pseudocode that was wrong. Could someone help me to solve it, please..!
Here's the pseudocode
cOZ I'm an Indonesian. There're Lots of sentences using Bahasa Indonesia there...
Anyway, Thanks 4 ur attention..!!
I'm a newcomer here. And looks like need your help here. I 've just make a program tha simulates The HRN CPU Scheduler.I have no problem in compiling it. But, when I run it, It won't work.
I don't know which Part of my pseudocode that was wrong. Could someone help me to solve it, please..!
Here's the pseudocode
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <conio.h> #include <math.h> #include <iomanip.h> typedef struct { float Prioritas; int Waiting; int Lama; int TA; char ID; }Penjadwalan; typedef Penjadwalan Proses[6]; void main() { Proses HRN; int i,j,time,Min; float Max; /*INPUT PROSES*/ HRN[1].ID = 'A'; HRN[1].Lama= 12; HRN[2].ID = 'B'; HRN[2].Lama= 57; HRN[3].ID = 'C'; HRN[3].Lama= 32; HRN[4].ID = 'D'; HRN[4].Lama= 10; HRN[5].ID = 'E'; HRN[5].Lama= 40; /******************/ /*Menampilkan hasil input*/ printf("Sebelum\n"); for (i=1; i<6; i++) { HRN[i].Waiting = 0; printf("ID : %c\n",HRN[i].ID); printf("Layanan : %d\n",HRN[i].Lama); printf("Waiting : %d\n\n",HRN[i].Waiting); } getch(); /******************/ clrscr(); /*Melakukan Eksekusi HRN*/ time=0; for (i=1; i<6; i++) { /*Jika wktu belum berjalan cari Lama dgn wkt terkecil*/ if ( time == 0 ) { /*PROSEDUR untuk mencari Min*/ Min = HRN[1].Lama; for (j=2; j<6; j++) { if ( Min > HRN[j].Lama ) { Min = HRN[j].Lama; } } /******************************************************/ for(j=1; j<6; j++) { if (Min == HRN[j].Lama) { time=time+HRN[j].Lama; HRN[j].Lama=0; printf("Proses '%c' Telah Di eksekusi\n\n", HRN[j].ID); } } printf("Waktu Sekarang: %d\n\n",time); } /*****************************************************************/ else { printf("Perputaran ke-%d\n\n",i); for (j=1; j<6; j++) { HRN[j].Waiting=time+HRN[j].Waiting; HRN[j].Prioritas = (HRN[j].Waiting + HRN[j].Lama)/ HRN[j].Lama; printf("Proritas Proses '%c' = %f\n\n",HRN[j].ID,HRN[j].Prioritas); } /*PROSEDUR untuk mencari Prioritas Terbesar*/ Max=HRN[1].Prioritas; for (j=2;j<6;j++) { if ( Max < HRN[j].Prioritas ) { Max = HRN[j].Prioritas; } } /*******************************************/ for(j=1; j<6; j++) { if (Max == HRN[j].Prioritas) { time=time+HRN[j].Lama; HRN[j].Lama=0; printf("Proses '%c' Telah Di eksekusi", HRN[j].ID); } } } } /******************/ }
cOZ I'm an Indonesian. There're Lots of sentences using Bahasa Indonesia there...
Anyway, Thanks 4 ur attention..!!
![]() |
Other Threads in the C Forum
- Previous Thread: Controlling Floppy Disk Head using C
- Next Thread: Please help me fix these errors
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue mysql number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi






