+ 2

Functions

who can explain the functions in c ++????

23rd Mar 2018, 2:54 PM
ΔΕΝ
ΔΕΝ - avatar
2 Réponses
+ 2
A function is a group of statements that together perform a task. Every C++ program has at least one function, which is main(). A function is known with various names like a method or a sub-routine or a procedure etc. There are two types of Function. 1/ Built-in Function 2/ User Define Function A C++ function definition consists of a function header and a function body. Here are all the parts of a function − 1/ Return Type 2/ Function Name 3/ Parameters 4/ Function Body Example : #include <iostream> using namespace std; int sum(int a = 20, int b = 30) /* function with parameters. function name = sum, parameters = a,b & value type = integer. */ { //function body int result; result = a + b; return (result); } int main () { // local variable declaration: int a = 100; int b = 200; int result; // calling a function to add the values. result = sum(a, b); cout << "Total value is :" << result; return 0; // return value. }
23rd Mar 2018, 4:18 PM
M.N. Sadik
M.N. Sadik - avatar
+ 5
Would you like for me the explain the function of functions? It's exactly that. Set of code that has a particular purpose, a particular function, that can be called upon from other code. https://www.sololearn.com/Course/CPlusPlus/ Module 4: Functions ^Keep going through the course and Module 4 explains a lot about functions, what they are, and how you use them. Best of luck!
23rd Mar 2018, 3:07 PM
Fata1 Err0r
Fata1 Err0r - avatar