c lookdisk

4
Output- c-look disk scheduling algorithm enter maximum no. of cylinders of disk you want to access 8 98 183 37 122 14 124 65 67 enter the direction from where you want to start left'0' , right'1' 1 enter the initial position of cylinder 53 65 67 98 122 124 183 14 37 Process returned 0 (0x0) execution time : 24.437 s Press any key to continue.

Upload: ankush-kapoor

Post on 18-Dec-2015

3 views

Category:

Documents


1 download

DESCRIPTION

c++ prog

TRANSCRIPT

Output- c-look disk scheduling algorithmenter maximum no. of cylinders of disk you want to access898 183 37 122 14 124 65 67enter the direction from where you want to start left'0' , right'1'1enter the initial position of cylinder53

65 67 98 122 124 183 14 37

Process returned 0 (0x0) execution time : 24.437 sPress any key to continue.

#include#include#include#include#includeusing namespace std;int main(){ int n,start,counti=0,mini,pos,direc; printf("enter maximum no. of cylinders of disk you want to access\n"); scanf("%d",&n); int arr[30]; for(int i=0;i=0;i--) { printf("%d ",arr[i]); } for(int i=n-1;i>mid;i--) { printf("%d ",arr[i]); } } if(direc==1) { for(int i=mid;i