List of all available Websheets
Viewing cpp/conditionals/testScoreChecker 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>Three friends want to compare their test scores, but do not want to reveal their scores to each other. To get around this issue they are trying to write a program that will take in all of their scores and tell them the name of the student who received the best score, without revealing any scores.</p> <p>To make sure that nobody enters an absurd test score to trick the program into saying they had the best score, the students also want to include a checker to ensure that it is a valid test score (0-100%).</p> <p>Help them finish the program!</p> <p>For valid test scores you should print a message to the screen that reads:</p> <tt>The person who received the highest score on the test is </tt> and then the student's name. <p>Tips:</p> <ul><li>Two students will never have the same test score.</li> <li>If a student does enter an invalid score print out a message that there is an invalid score, and do <strong>NOT</strong> print out anything else.</li> </ul> |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/cs102/practice6/tippingCalculator (author: jmell@usc.edu) Copied from problem cpp/cs102/practice5/computingPie (author: jmell@usc.edu) |
Engine | |
Template / Reference solution |
using namespace std; int main() { string name1, name2, name3; double num1, num2, num3; cin >> name1 >> name2 >> name3; cin >> num1 >> num2 >> num3; if (\[ REDACTED ]\) { cout << "Invalid test score!" << endl; } else { \[ REDACTED ]\ } 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":"Tommy Traveler Hecuba 88 -15 90", "args":[]}, {"stdin":"Bovard Zumberge Nikias 45 95.4 95.5", "args":[]}, {"stdin":"John Jane Jill 100.1 84 87", "args":[]}, {"stdin":"Gamora Peter Drax 91 82 56", "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'.