Skip to content

Instantly share code, notes, and snippets.

@ronalddas
Created December 14, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronalddas/11fdc399e2c9797173e4 to your computer and use it in GitHub Desktop.
Save ronalddas/11fdc399e2c9797173e4 to your computer and use it in GitHub Desktop.
Different ways of passing values to function
/*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