#mastery<\/a>12 \u00a0#MASTERY<\/a>12 #TC<\/a>1017<\/p>\n I\u00b4m goint to teach how to create a function in c++<\/p>\n First of all you have to choose which type of function you want.<\/p>\n Void = to return nothing.<\/p>\n Int = to return a integer number.<\/p>\n double = to return a decimal number.<\/p>\n bool = to return true or false<\/p>\n string = to return letters.<\/p>\n etc etc.<\/p>\n Well now that you know the types of functions you will have to select the \u00a0type you want for your variables which are pretty much the same.<\/p>\n Now, the syntax to do a function is:<\/p>\n type nameoffunction(variables, parameters)<\/p>\n {<\/p>\n }<\/p>\n ——————————————–<\/p>\n Let\u00b4s say, we want to create a function which make the sum of two integer numbers<\/p>\n int sumnum(int x, int y)<\/p>\n {<\/p>\n \u00a0 \u00a0 \u00a0int c;<\/p>\n \u00a0 \u00a0 \u00a0c = x + y;<\/p>\n \u00a0 \u00a0 \u00a0return c;<\/p>\n }<\/p>\n \u00a0<\/p>\n Hope you understand how to create a function, it is really easy and don\u00b4t be afraid to create them because it will save a lot of coding and your int main() will be a lot shorter.<\/p>\n \u00a0<\/p>\n Hope you understand so i can get my two points!<\/p>\n \u00a0<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":" #mastery<\/a>12 #MASTERY<\/a>12 #TC<\/a>1017<\/p>\n I´m goint to teach how to create a function in c++<\/p>\n First of all you have to choose which type of function you want.<\/p>\n Void = to return nothing.<\/p>\n Int = to return a integer number.<\/p>\n double = to return a decimal number.<\/p>\n bool = to return true or false<\/p>\n string = to return letters.<\/p>\n etc etc.<\/p>\n Well now that you know the types of functions you will have to select the type you want for your variables which are pretty much the same.<\/p>\n Now, the syntax to do a function is:<\/p>\n type nameoffunction(variables, parameters)<\/p>\n {<\/p>\n }<\/p>\n ——————————————–<\/p>\n Let´s say, we want to create a function which make the sum of two integer numbers<\/p>\n int sumnum(int x, int y)<\/p>\n {<\/p>\n int c;<\/p>\n c = x + y;<\/p>\n return c;<\/p>\n }<\/p>\n <\/p>\n Hope you understand how to create a function, it is really easy and don´t be afraid to create them because it will save a lot of coding and your int main() will be a lot shorter.<\/p>\n <\/p>\n Hope you understand so i can get my two points!<\/p>\n <\/p>\n<\/div>\n