+ 8
FUNCTIONS ?
I have started functions in C++ from the very beginning but during the very first lecture i was confused.I was unable to understand anything about functions 😭😭😭 Would you please like to put me on path to functions ? You just have to told me 👇🏻 introduction to functions ? 👇🏻 Definition of function. 👇🏻 declaration of functions. 👇🏻 Function Call 👇🏻 Return type of function . Just Explain Briefly .
13 Answers
+ 6
Ok ... the functions is something to make your code simple to read and shortcut the code .... Ok if you want to repeat a code many time you have to make a function for example : (From real life but it thr same as programing)
you love coffee and you make coffee every day so you repeat this work ... Ok lets see this function >> void coffee make () {
cout << "get coffee";
cout <<"get water";
cout << "put the water on fire";
cout << "add coffee";
cout << "put coffee in cup";
}
if you want to repeat these commands many times you just need to call the function many time not to write
cout <<"get coffee";
cout <<"get water";
.
.
.
etc
so this shortcut alot if you want to repeat it many times
to call the function you just need to write the name of the function and (); for example
coffeemake ();
the computer will do all cout command that i wrote before so you have to define the function before use and out side of the main function ....
.. am sorry if i made english mistakes ... am not english man
+ 11
Christoph Behl
thanks 👍
+ 8
Saurabh Tiwari
thank you 👍
+ 8
Mohammad Alshareef
i got it .
excellent.
well explained.
thanks 👍💚
+ 7
+ 7
confused ?
+ 7
Seb TheS
got it .
thanks 👍
+ 5
https://www.sololearn.com/post/10888/?ref=app
you can refer to this site
+ 4
shehroz irfan you are welcome.
+ 1
I don't study C++, but I know very good what are functions in Python.
Functions are type of objects, that return a value depending on their arguments.
Functions are called as function name followed by a parenthesis pair having comma separated values called arguments.
In function definition the values are called parameters rather than arguments, parameters can't be used outside the function definition.
+ 1
much more simple you can repeat functions in main. reduces code!
+ 1
Thanks
0
Functions are central to C programming and are used to accomplish a program solution as a series of subtasks.