Created
December 14, 2015 14:11
-
-
Save ronalddas/11fdc399e2c9797173e4 to your computer and use it in GitHub Desktop.
Different ways of passing values to function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Passing Results of one function to another function | |
It is easy... Damn, I dont i Tinker with my code more often | |
I only realised this after doing Python course on Codecadmy | |
*/ | |
#include <iostream> | |
using namespace std; | |
int add_Number(int a , int b) | |
{ | |
return a+b; | |
} | |
int multiply(int a , int b) | |
{ | |
return add_Number(a,b)*a*b;//This works like python | |
} | |
int main(void) | |
{ | |
int a = 0 , b =0 ,c =0; | |
cin>>a>>b>>c; | |
cout<<add_Number(a,b)<<endl; | |
cout<<multiply(a,b)<<endl; | |
cout<<multiply(add_Number(a,b),c)<<endl;//Why the hell did i never try it before | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment