CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - printf.c
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Search - printf.c - List
[
Disk Tools
]
NStepSCAN
DL : 1
NStepSCAN N步磁盘扫描调度算法C++程序-#include "stdafx.h" #include "stdlib.h" int L,P int a[20] int flag //访问位 typedef struct TASK { int requrie int io } TASK TASK T[50][50] TASK N[50] int diskway //当前磁道 void iodowith() void init() { int i,j for(i=0 i<20 i++) { for(j=0 j<20 j++) { T[i][j].requrie=-1 } } for(i=0 i<L i++) { for(j=0 j<P j++) { T[i][j].requrie=rand() 200 T[i][j].io=rand() 2 } } } void output() { printf("磁盘访问的初始顺序是:\n") for(int i=0 i<L i++) { printf("第 d组是:\n",i+1) for(int j=0 j<P j++) { printf(" d d\t",T[i][j].requrie,T[i][j].io) } printf("\n") } } void sort_btos(TASK x[],int n) { int i,j,k TASK t for(i=0 i<n-1 i++) { k=i for(j=i+1 j<n j++) if(x[j].requrie>x[k].requrie) k=j if(k!=i) { t=x[i] x[i]=x[k] x[k]=t } } } void sort_stob(TASK x[],int n) { int i,j,k TASK t fo
Date
: 2025-12-21
Size
: 1kb
User
:
吴英杰
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.