[SOLVED] CS计算机代考程序代写 import “io”

30 $

File Name: CS计算机代考程序代写_import_“io”.zip
File Size: 423.9 KB

SKU: 2736678933 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


import “io”

/*
devctl(DC_TAPE_LOAD, unit#, “filename”, ‘R’ or ‘W’)
devctl(DC_TAPE_READ, unit#, buffer)
devctl(DC_TAPE_WRITE, unit#, buffer, blocksizeinbytes)
devctl(DC_TAPE_UNLOAD, unit#)

all return codes pos or zero = success
negative is error message index
for read, the result is size of block
*/

let buffer = vec(128);
let pos = 0;
let size = 0;

let ropen(fname) be
{ let r = devctl(DC_TAPE_LOAD, 1, fname, ‘R’);
if r < 0 then{ out(“code %d from tape load
“, r);finish }pos := 0 }let rclose() be{ let r = devctl(DC_TAPE_UNLOAD, 1);if r < 0 then{ out(“code %d from tape unload
“, r);finish } }let rchar() be{ let c;if pos = size then{ let r = devctl(DC_TAPE_READ, 1, buffer);if r < 0 then{ out(“code %d from tape read
“, r);finish }pos := 0;size := r }if pos = size thenresultis -1;c := byte pos of buffer;pos +:= 1;resultis c }let rnum() be{ let n = 0, c = rchar();while c < ‘ ‘ doc := rchar();while c >= ‘0’ / c <= ‘9’ do{ n := n * 10 + c – ‘0’; c := rchar() }resultis n }let start() be{ ropen(“numbers.txt”);while true do{ let n = rnum();out(“The number is %d
“, n) }rclose() }

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS计算机代考程序代写 import “io”
30 $