V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
freehehe
V2EX  ›  问与答

这个节点问题目没事吧?碰到操作系统题目不会做求帮助

  •  
  •   freehehe · Jun 13, 2020 · 2057 views
    This topic created in 2156 days ago, the information mentioned may be changed or developed.
    下面的程序是作业调度程序的片段。请仔细阅读,找出三条错误的语句并更正之。
    typedef struct jcb
    { char na[4];
    int len,ta,rt,wt;
    struct jcb *next;
    } jcb;
    jcb *head;
    int ta;
    long mem;
    shedl()
    {
    1、 float xk,k;
    2、 jcb *p,*q,*s,*t;
    3、 do
    4、 {p=head;
    5、 s=null;
    6、 q=null;
    7、 k=0;
    8、 while (p!=null){
    9、 { if(p->len<=mem)
    10、 xk=(float)(p->wt)/p->rt;
    11、 if(q==null||xk>k)
    12、 { k=xk;q=p;t=s;}
    13、 }
    14、 s=p;
    15、 p=p->next;
    16、 }
    17、 if (q!=null)
    18、 { if(t==null)
    19、 head=head->next;
    20、 else
    21、 t->next=q->next;
    22、 mem=q->len;
    23、 ta=ta-q->ta;
    24、 printf("选中作业:%s\n",q->na);
    25、 }
    26、 } while(ta>0);

    程序说明:jcb[]-作业调度表(结构类型);na[]-作业名; len-内存长度; rt-运行时间; wt-等待时间;mem-内存长度; ta-设备台数。
    5 replies    2020-06-13 17:37:28 +08:00
    asanelder
        1
    asanelder  
       Jun 13, 2020   ❤️ 1
    既然问问题呢,态度就要好一点点啦
    良好的排版也是对回答者的尊重哦~~~~~
    wzzzx
        2
    wzzzx  
       Jun 13, 2020   ❤️ 1
    港真,我搜问题搜到这样的代码片段都直接关掉
    Jooooooooo
        3
    Jooooooooo  
       Jun 13, 2020   ❤️ 1
    重新问吧
    EminemW
        4
    EminemW  
       Jun 13, 2020
    这代码格式让你来看,你能看得下不
    chanlk
        5
    chanlk  
       Jun 13, 2020
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3051 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 14:14 · PVG 22:14 · LAX 07:14 · JFK 10:14
    ♥ Do have faith in what you're doing.