List of all available Websheets
Viewing cpp/var-expr/math 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 | Write a program that takes integer inputs <code>x</code> and <code>y</code>, and outputs 3 lines containing: <ul> <li>Their difference <li>Their average <li>The quotient (as a double) of <tt>x</tt> divided by <tt>y</tt> </ul> For example, if the input is <tt>18 4</tt>, the output should be <pre> 14 11.0 4.5 </pre> |
Public permissions | |
Remarks Comments, history, license, etc. | Originally by Mark Redekopp (redekopp@usc.edu) and Dave Pritchard (daveagp@gmail.com) |
Engine | |
Template / Reference solution |
using namespace std; int main() { \[ int x, y; cin >> x >> y; cout << x-y << endl; cout << (x+y)/2.0 << endl; cout << static_cast<double>(x) / y << 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": "20 3"}, {"stdin": "5 4"}, {"stdin": "100 4"}, {"stdin": "3 20"} ] |
Solution visibility | |
Is example? i.e., just a demo |
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'.