Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services.C++ Function and their work | C++ Toturials Bestitworrior
C++ Function and their work
C++ Function and their work | C++ Toturials Bestitworrior - Function is a block of code run when it is called.Function can't run without calling it.You can also pass one parameter or more.Function also return value .Functon code wirtten once and can be reuse it for many purposes.Function perform certein data operation inside the function.Function syntex is very simple void function_name(){//code}
Some Key Points of C++ Function
- Function is a combined block of code run when it execute
- Function can't run without calling it
- Function can return result
- Function perform various operation
- Function code is reuseable and for multipurpose
- You can send one or more then one parameter to function
Code
# include <iostream>
using namespace std;
void Function1()
{
cout << "I just got executed!\n";
}
void Function2(string fname) {
cout << fname << " Refsnes\n";
}
void Function3(string fname, int age) {
cout << fname << " Refsnes. " << age << " years old. \n";
}
int Function4(int x) {
return 5 + x;
}
int main()
{
Function1();
Function2("Best It Worrior is best platform");
Function3("Worrior", 36);
cout << Function4(10);
return 0;
}
OutPut
I just got executed!
Best It Worrior is best platform Refsnes
Worrior Refsnes. 36 years old.
15
Best It Worrior is best platform Refsnes
Worrior Refsnes. 36 years old.
15
0 Comments