Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Simple Function | Introduction to Functions
C++ Introduction
course content

Course Content

C++ Introduction

C++ Introduction

1. Getting Started
2. Variables and Data Types
3. Introduction to Operators
4. Introduction to Program Flow
5. Introduction to Functions

book Simple Function

Example of the function with arguments from the previous chapter

cpp

main

copy
1234567891011
#include <iostream> int func(int a, int b) { return a + b; //the function to sum arguments } int main() { std::cout << "sums the arguments = " << func(5, 7); }

Task

  • Create a simple add function (a+b).
  • Test the function with x = 5, y = 10.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 5. Chapter 5
toggle bottom row

book Simple Function

Example of the function with arguments from the previous chapter

cpp

main

copy
1234567891011
#include <iostream> int func(int a, int b) { return a + b; //the function to sum arguments } int main() { std::cout << "sums the arguments = " << func(5, 7); }

Task

  • Create a simple add function (a+b).
  • Test the function with x = 5, y = 10.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 5. Chapter 5
toggle bottom row

book Simple Function

Example of the function with arguments from the previous chapter

cpp

main

copy
1234567891011
#include <iostream> int func(int a, int b) { return a + b; //the function to sum arguments } int main() { std::cout << "sums the arguments = " << func(5, 7); }

Task

  • Create a simple add function (a+b).
  • Test the function with x = 5, y = 10.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Example of the function with arguments from the previous chapter

cpp

main

copy
1234567891011
#include <iostream> int func(int a, int b) { return a + b; //the function to sum arguments } int main() { std::cout << "sums the arguments = " << func(5, 7); }

Task

  • Create a simple add function (a+b).
  • Test the function with x = 5, y = 10.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 5. Chapter 5
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt