Value Returning Functions in C++:
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!
#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;
system("pause");
}
int pytho(int a, int b)
{
float c;
c = a*a + b*b;
c=sqrt(c);
return (c);
}