This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:fall2022:cprog:projects:sam0 [2021/09/12 13:32] – created - external edit 127.0.0.1 | haas:fall2022:cprog:projects:sam0 [2022/10/16 15:12] (current) – [Submission] wedge | ||
---|---|---|---|
Line 60: | Line 60: | ||
Your program should be a "one shot". It should only perform its intended operation and exit. No prompting for encode/ | Your program should be a "one shot". It should only perform its intended operation and exit. No prompting for encode/ | ||
- | When compiling, an additional constraint is added: compile with the **-Wall** and **< | + | When compiling, an additional constraint is added: compile with the **-Wall** and **< |
====Sample execution: encode==== | ====Sample execution: encode==== | ||
Via positive command-line key: | Via positive command-line key: | ||
Line 142: | Line 142: | ||
lab46: | lab46: | ||
</ | </ | ||
+ | |||
+ | =====Pseudocode===== | ||
+ | |||
+ | ====encode==== | ||
+ | Your encode may end up flowing something like the following: | ||
+ | |||
+ | < | ||
+ | MODULE ENCODE (RECEIVES MESSAGE AND KEY): | ||
+ | LOOP THROUGH EACH CHARACTER IN THE MESSAGE: | ||
+ | CHARACTER IS SET TO NUMERIC VALUE OF CHARACTER PLUS THE KEY | ||
+ | SHOULD THE CHARACTER EXCEED THE RANGE OF DISPLAYABLE CHARACTERS: | ||
+ | RESET CHARACTER TO START OF RANGE PLUS REMAINING OFFSET OF KEY | ||
+ | SHOULD THE CHARACTER GO BELOW THE RANGE OF DISPLAYABLE CHARACTERS: | ||
+ | RESET CHARACTER TO END OF RANGE MINUS REMAINING OFFSET OF KEY | ||
+ | |||
+ | SET MODIFIED CHARACTER TO RESULT MESSAGE | ||
+ | END LOOP | ||
+ | SEND BACK RESULT MESSAGE | ||
+ | END MODULE | ||
+ | </ | ||
+ | |||
+ | ====decode==== | ||
+ | < | ||
+ | MODULE DECODE (RECEIVES MESSAGE AND KEY): | ||
+ | LOOP THROUGH EACH CHARACTER IN THE MESSAGE: | ||
+ | CHARACTER IS SET TO NUMERIC VALUE OF CHARACTER MINUS THE KEY | ||
+ | SHOULD THE CHARACTER EXCEED THE RANGE OF DISPLAYABLE CHARACTERS: | ||
+ | RESET CHARACTER TO START OF RANGE PLUS REMAINING OFFSET OF KEY | ||
+ | SHOULD THE CHARACTER GO BELOW THE RANGE OF DISPLAYABLE CHARACTERS: | ||
+ | RESET CHARACTER TO END OF RANGE MINUS REMAINING OFFSET OF KEY | ||
+ | |||
+ | SET MODIFIED CHARACTER TO RESULT MESSAGE | ||
+ | END LOOP | ||
+ | SEND BACK RESULT MESSAGE | ||
+ | END MODULE | ||
+ | </ | ||
=====Submission===== | =====Submission===== | ||
Line 147: | Line 183: | ||
* Code must compile cleanly (no warnings or errors) | * Code must compile cleanly (no warnings or errors) | ||
- | * Use the **-Wall** and **< | + | * Use the **-Wall** and **< |
* Output must be correct, and resemble the form given in the sample output above. | * Output must be correct, and resemble the form given in the sample output above. | ||
* Code must be nicely and consistently indented (you may use the **indent** tool) | * Code must be nicely and consistently indented (you may use the **indent** tool) |