User Tools

Site Tools


haas:fall2021:cprog:projects:cbf0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
haas:fall2021:cprog:projects:cbf0 [2021/03/22 14:53] – external edit 127.0.0.1haas:fall2021:cprog:projects:cbf0 [2021/09/12 13:26] (current) – [Process] wedge
Line 206: Line 206:
 00000030: 73 74 75 76 77 78 79 7a 5d 0a 30 31 3a 20 20 20  stuvwxyz].01:    00000030: 73 74 75 76 77 78 79 7a 5d 0a 30 31 3a 20 20 20  stuvwxyz].01:   
 </cli> </cli>
 +
 =====Detecting Terminal Size===== =====Detecting Terminal Size=====
 To detect the current size of your terminal, you may make use of the following code, provided in the form of a complete program for you to test, and then adapt into your code as appropriate. To detect the current size of your terminal, you may make use of the following code, provided in the form of a complete program for you to test, and then adapt into your code as appropriate.
Line 390: Line 391:
  
 Also, the do-while is the only one of our loops which NEEDS a terminating semi-colon (**;**).. please take note of this. Also, the do-while is the only one of our loops which NEEDS a terminating semi-colon (**;**).. please take note of this.
 +
 +=====Process=====
 +In general, you will be looking to do something like the following:
 +
 +<code>
 +address <- zero
 +byte <- readfromfile
 +ascii[zero] <- byte
 +count <- one
 +loop as long as there is still data in the file
 +    display the address in hex
 +    if count is equal to one
 +        display the byte in hex
 +    endif
 +
 +    loop as long as count is less than sixteen
 +        byte <- readfromfile
 +        if there is still data in the file
 +            ascii[count] <- byte
 +            display the byte in hex
 +            let count increment by one
 +        else
 +            loop as long as count is less than sixteen
 +                display a space
 +            endloop
 +            break from loop
 +        endif
 +    endloop
 +    
 +    loop index from zero to count
 +        if ascii[index] is a printable character
 +            display ascii[index] as an ASCII character
 +        else
 +            display the period symbol
 +        endif
 +    endloop
 +    display a newline
 +    let count be equal to zero
 +    let address be incremented by sixteen
 +endloop
 +</code>
  
 =====Submission===== =====Submission=====
haas/fall2021/cprog/projects/cbf0.1616424839.txt.gz · Last modified: 2021/03/22 14:53 by 127.0.0.1