Value Returning Functions

Published on: October 31, 2010

Today I show you how to use Value Returning Functions in C++. Functions can come in very handy. Here I show you how to use return functions and use the Pythagorean Theorem Program that I created several months ago and I turn the calculation into a value returning function. In the future, I hope to provide you with more complex programs consisting of value returning functions as well as introduce to you the Void Function which comes in very handy as well. If you have any questions about the program or functions in general, feel free to ask. I hope you enjoy the video and if you have any requests feel free to let me know. Thanks for watching ! Thanks for watching and thanks for your supportand remember to subscribe!

Remember to checkout the Codesnip below to review the C++ code yourself! Feel free to copy the code, but I ask that you please provide credit if you leave the code unchanged when you use it.


//Programmer:  Nazmus
//Program:   Value Returning Function Tutorial

#include <iostream>
#include <string> 

using namespace std;

int main()

int pytho(int a, int b);

int main()

 int a, b;
 float c;

 cout << "Please input value of 'a' and 'b': ";
 cin >> a >> b;

 pytho(a, b);

 c = pytho(a,b);
 cout << "The hypotenuse is: " << c << '.' << endl;



int pytho(int a, int b)
 float c;
 c = a*a + b*b;

 return (c);