List of all available Websheets
Viewing cpp/while/whilen 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>Demo program that uses a <tt>while</tt> structure to loop n times by incrementing a variable each iteration until it reaches <tt>n</tt></p> <p>Feel free to modify the body of the loop to do anything that you want to repeat n times.</p> <p></p> <p><strong>This is just an example and is NOT checked. So it will not turn green.</strong></p> |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/while/goldilocks (author: redekopp@usc.edu) Copied from problem cpp/while/sum50 (author: redekopp@usc.edu) Copied from problem cpp/conditionals/rps (author: redekopp@usc.edu) Copied from problem cpp/conditionals/taxbrackets (author: redekopp@usc.edu) Copied from problem cpp/conditionals/nestedec (author: redekopp@usc.edu) Copied from problem cpp/conditionals/extracredit (author: redekopp@usc.edu) Copied from problem cpp/control/flag (author: daveagp@gmail.com) |
Engine | |
Template / Reference solution |
using namespace std; int main() { int i, n; cin >> n; \[ \show: i=0; while(i < n) { cout << i << endl; i++; } ]\ 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": "5", "args": ""}, {"stdin": "10", "args": ""} ] |
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'.