List of all available Websheets
Viewing cpp/cs102/practice5/messageDecoder by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | <p>You are a spy infiltrating an enemy territory. To communicate with your country hundreds of miles away you use a message system able to send 4 numbers at a time. </p> <p>Because you don’t want your enemies intercepting the message, there is a special decoding protocol used to decipher these messages and turn these numbers into characters.</p> <br> <p>First Letter = Take the first number (integer) and convert directly to ASCII equivalent.</p> <p>Second letter = Take the second number (the double); use only the digits <strong>before</strong> the decimal and convert to ASCII equivalent.</p> <p>Third letter = Take the second number again (the double); use only the 2 digits <strong>after</strong> the decimal and convert to ASCII eqivalent.</p> <p>Fourth letter = Take the third and fourth numbers (integers); add them together and convert to ASCII equivalent.</p> <br> <p>Write a program able to take these 4 numbers and turn them into the intended message.</p> |
Remarks Comments, history, license, etc. | Copied from problem cpp/cs102/practice5/computingPie (author: jmell@usc.edu) |
Engine | |
Template / Reference solution |
using namespace std; int main() { int i1, i3, i4; double i2; cin >> i1 >> i2 >> i3 >> i4; char c1 = \[ REDACTED ]\ char c2 = \[ REDACTED ]\ char c3 = \[ REDACTED ]\ char c4 = \[ REDACTED ]\ cout <<"Message: " << c1 << c2 << c3 << c4 <<endl; return 0; } |
C++ test suite json list of stdin/args tests e.g. [{"stdin":"hi", "args":["4", "5"]}, {"stdin":"noargs"}] to just run once with no input use [{}] | [ {"stdin":"72 69.76 20 60", "args":[]}, {"stdin":"85 83.67 11 22", "args":[]}, {"stdin":"67 83.67385 70 3", "args":[]} ] |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.