Rajnish Kaushik Posted January 1, 2014 Share Posted January 1, 2014 Can someone help me on functions in c++ Link to comment Share on other sites More sharing options...
pears Posted January 1, 2014 Share Posted January 1, 2014 You'll need to be a bit more specific than that 3 Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 2, 2014 Author Share Posted January 2, 2014 i did not understood anything on functions Link to comment Share on other sites More sharing options...
pears Posted January 2, 2014 Share Posted January 2, 2014 What exactly are you having trouble with? Do you have an example? Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 2, 2014 Author Share Posted January 2, 2014 How to i use it in programs and why? Link to comment Share on other sites More sharing options...
pears Posted January 2, 2014 Share Posted January 2, 2014 http://www.cplusplus.com/doc/tutorial/functions/ 3 Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 2, 2014 Author Share Posted January 2, 2014 Thats to hard can u have something more simpler please Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 2, 2014 Author Share Posted January 2, 2014 need tutorials on Functions in c++ Link to comment Share on other sites More sharing options...
Lightmeow Posted January 2, 2014 Share Posted January 2, 2014 Heres a good link: http://www.cplusplus.com/doc/tutorial/functions/ 1 Link to comment Share on other sites More sharing options...
Strange Posted January 2, 2014 Share Posted January 2, 2014 A function is a piece of code with a name. You can provide it with values and it can return a value when it completes. It is a type of subroutine. http://www.cs.utah.edu/~germain/PPS/Topics/functions.html http://en.wikipedia.org/wiki/Subroutine Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 3, 2014 Author Share Posted January 3, 2014 thnx Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 3, 2014 Author Share Posted January 3, 2014 thnx to both of u Link to comment Share on other sites More sharing options...
Lightmeow Posted January 4, 2014 Share Posted January 4, 2014 What are you asking, I know java, so it might not be the same for c++, but a function could be 8+4, if maybe you are trying to make a math application, or are you asking about something defining a function? Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 4, 2014 Author Share Posted January 4, 2014 simple school level functions in c++ Link to comment Share on other sites More sharing options...
Lightmeow Posted January 4, 2014 Share Posted January 4, 2014 I'm going to have to do some research in it. Link to comment Share on other sites More sharing options...
Rajnish Kaushik Posted January 4, 2014 Author Share Posted January 4, 2014 I'm going to have to do some research in it. thanks Link to comment Share on other sites More sharing options...
Binary Tree Posted April 26, 2018 Share Posted April 26, 2018 (edited) A function is a way to encapsulate a block of code. Say you have to do some computation multiple times. Instead of repeating the code that does the computation multiple times, you enclose that code in a function, and call the function every time you need to do the computation. A big advantage of this is that if you need to modify the computation code, you only need to do that in one place. Another important use for functions is to decompose other long functions. Say you have a function where you first do A, then B, and then C. It is a good idea to separate the code that does A into a function, the code that does B into another function, and the code that does C into yet another function. Then you have your function just call those three functions. This makes it much easier to read and maintain you code. Edited April 26, 2018 by Binary Tree Link to comment Share on other sites More sharing options...
thuvienkhoahoc Posted November 29, 2019 Share Posted November 29, 2019 If you find it difficult to use a function in a C ++ language that you can describe ??? Link to comment Share on other sites More sharing options...
petrushka.googol Posted December 19, 2019 Share Posted December 19, 2019 Functions return a value but it can be an array... Recursive functions can call the same function again eg. Fibonacci Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now