List of all available Websheets
Viewing cpp/cs102/functions/aabbaa 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>Given the main() function below which calls 3 other functions, complete the body of the 3 other functions such that the output of the program will be <strong><tt>aabbaa</tt></strong> followed by a <strong>newline</strong>.</p> <p>Examine the order of the function calls and how the second call to f1 is composed of a call to f2.</p> |
Public permissions | |
Remarks Comments, history, license, etc. | Copied from problem cpp/functions/hypotenuse (author: redekopp@usc.edu) Copied from problem cpp/functions/abs_func (author: redekopp@usc.edu) |
Engine | |
Template / Reference solution |
using namespace std; void f1(char c); char f2(char c); void f3(); int main() { char c = 'a'; f1(c); f1(f2(c)); f1(c); f3(); return 0; } void f1(char c) { \[ cout << c << c; ]\ } char f2(char c) { \[ return c+1; ]\ } void f3() { cout << \[ endl ]\; } |
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 [{}] | [ {} ] |
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'.