List of all available Websheets
Viewing cpp/cs102/distributed-and/increasing 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>An instructor believes she teaches better each semester and aims to prove it by entering the average final exam score for each semester in order up through the current semester, entering <tt>-1</tt> upon completion. Your program should check that the values entered are increasing (always larger than the previous value).</p> <p></p> <p>If her belief is true, output <tt>True</tt>. If it is not true, output <tt>False</tt> and <strong>do so as early as the data reveals the belief is false</strong>.</p> |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/cs102/selection/tallest (author: redekopp@usc.edu) Copied from problem cpp/cs102/map/parabola (author: redekopp@usc.edu) Copied from problem cpp/for/div-without-div (author: redekopp@usc.edu) Copied from problem cpp/for/polydeg (author: redekopp@usc.edu) Copied from problem cpp/for/blastoff (author: redekopp@usc.edu) Copied from problem cpp/while/blastoff (author: redekopp@usc.edu) 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() { double avg; // declare other variables you need here \[ double last; ]\ bool increasing = \[ true ]\ ; \[ cin >> last >> avg; while(avg != -1){ if( avg <= last ){ increasing = false; break; } last = avg; cin >> avg; } ]\ if( increasing ) { cout << "True" << endl; } else { cout << "False" << 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": "0.5 1.0 1.5 2.0 2.5 -1", "args": ""}, {"stdin": "0.5 1.0 1.5 2.0 .25 -1", "args": ""}, {"stdin": "0.5 0.4 1.0 -1", "args": ""} ] |
Solution visibility |
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'.