Learn

Roll up your sleeves and get yourself in the mood for functions, because it’s code challenge time!

Say what? Here’s how it works:

  • Each exercise in this lesson has a C++ function for you to build.
  • Each challenge has many solutions and we encourage you to be creative.
  • We don’t care what goes on in the function as long as it works the way it should. (Notice those tests in main() for each function.)

As a refresher, C++ function syntax looks like this:

return_type function_name(paramater1, parameter2) { // Code block here return output_if_there_is_any; }

For example, with real code this might look like:

bool is_even(int number) { if (number % 2 == 0) { return true; } return false; }

Best of luck!

Instructions

Move onto the first challenge once you are ready.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?