Hello friends ...
Scholars
computer I have to apologize to you because I've written anything in good time, but the reason for this is that the university leaves me pretty busy, but I'm here for you, you visit and read my articles.
This month I'll discuss some more advanced programming (we are not beginners) in Borland C + +, is a bit short but it helps to increase our development in this language
Begin!
First, what is a function? Is a subroutine that executes a series of statements with certain values \u200b\u200band only returns a single value. So, this function can be called from the main program no matter how many times is called.
Mention "certain values" that values \u200b\u200bare called parameters, which are data that the function will work. Furthermore I "Return value" means any function performs this operation, but one must take into account the value to be returned, must be same type as the variable that will pick up that value. I can not say that the whole function and the variable that will pick up the value, it is floating. Produces an undesired result.
How to declare a feature?
bookstores
When we declare that we will use in the program, immediately declaring the function, along with its parameters that will gridding.
Example:
( ... etc)
int sum (int a, int b) How
I call it?
In the main program, just type the name, plus the parameters of that function. This tells the C + + compiler which is a function that is invoked.
Example:
sum (a, b)
And then, the function?
After you declare the function and you make the call, of course, you program the function. Is declared as follows:
(parameters)
sum (int a, int b) It
write all you want me to do the role, but considering that only return a single return value.
Something very important! After terms of structures that your function, you should always put the keyword "return ()" and the parentheses, the value to be returned. It tells the program that is over the role and will send a return value ... as they say: hey! I finished, I'm coming ... hahahaha ... I mean?
Here is an example of a simple function of adding two numbers, so that they look better:
# include # include
/ / declare
function int sum (int a, int b) void main
()
{int w, e, h;
printf ("program that adds two numbers \\ n");
printf ("First number \\ n");
scanf ("% d", & w);
printf ("Second number \\ n");
scanf ("% d", & e);
/ / call the function and what returns, which manages the variable "h"
h = sum (w, e);
printf ("\\ n% d", h);
} / / function header has this structure
sum ( int a, int b)
{int k;
k = a + b;
return (k) / / indicates that the function ends and it will return a value}
Well dude, I think that is
all hope that everything has become clearer than water from the jar
Anything, I get a email and how much pleasure they clarify the question
Thanks for taking a moment of your time to visit ...
See you next month!
Saellvertu og God Morgen!
Scholars
computer I have to apologize to you because I've written anything in good time, but the reason for this is that the university leaves me pretty busy, but I'm here for you, you visit and read my articles.
This month I'll discuss some more advanced programming (we are not beginners) in Borland C + +, is a bit short but it helps to increase our development in this language
Begin!
First, what is a function? Is a subroutine that executes a series of statements with certain values \u200b\u200band only returns a single value. So, this function can be called from the main program no matter how many times is called.
Mention "certain values" that values \u200b\u200bare called parameters, which are data that the function will work. Furthermore I "Return value" means any function performs this operation, but one must take into account the value to be returned, must be same type as the variable that will pick up that value. I can not say that the whole function and the variable that will pick up the value, it is floating. Produces an undesired result.
How to declare a feature?
bookstores
When we declare that we will use in the program, immediately declaring the function, along with its parameters that will gridding.
Example:
int sum (int a, int b) How
I call it?
In the main program, just type the name, plus the parameters of that function. This tells the C + + compiler which is a function that is invoked.
Example:
sum (a, b)
And then, the function?
After you declare the function and you make the call, of course, you program the function. Is declared as follows:
sum (int a, int b) It
write all you want me to do the role, but considering that only return a single return value.
Something very important! After terms of structures that your function, you should always put the keyword "return ()" and the parentheses, the value to be returned. It tells the program that is over the role and will send a return value ... as they say: hey! I finished, I'm coming ... hahahaha ... I mean?
Here is an example of a simple function of adding two numbers, so that they look better:
# include # include
/ / declare
function int sum (int a, int b) void main
()
{int w, e, h;
printf ("program that adds two numbers \\ n");
printf ("First number \\ n");
scanf ("% d", & w);
printf ("Second number \\ n");
scanf ("% d", & e);
/ / call the function and what returns, which manages the variable "h"
h = sum (w, e);
printf ("\\ n% d", h);
} / / function header has this structure
sum ( int a, int b)
{int k;
k = a + b;
return (k) / / indicates that the function ends and it will return a value}
Well dude, I think that is
all hope that everything has become clearer than water from the jar
Anything, I get a email and how much pleasure they clarify the question
Thanks for taking a moment of your time to visit ...
See you next month!
Saellvertu og God Morgen!