Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Function Overloading Practice | Some Advanced Topics
C++ Functions
course content

Зміст курсу

C++ Functions

C++ Functions

1. Introduction
2. Function Arguments Specification
3. Function Return Values Specification
4. Some Advanced Topics

Function Overloading Practice

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 4. Розділ 2
toggle bottom row

Function Overloading Practice

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 4. Розділ 2
toggle bottom row

Function Overloading Practice

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Завдання

Let's create a C++ program for a shape calculator that uses function overloading to calculate the area of different shapes (rectangle, circle, and triangle). These functions will have the same name but will be able to calculate area for different types of figures.

Your task is to create overloaded calculateArea() functions. All arguments must have double type:

  • The first function must have two positional arguments, length and width (the order of arguments must be the same!).
  • The second function must have one argument named radius.
  • The third function must have three arguments, a, b and c. These arguments represent the length of all sides of the triangle.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 4. Розділ 2
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt