SHARE
TWEET

Function Declaration and Invocation

polalengmylabs Aug 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
  5. C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <iostream>
  10.  
  11. using namespace std;
  12. //function prototype
  13. void helloWorld(); //Void function
  14.  
  15. //value-returning functions
  16. int addNum(int,int);
  17. int subNum(int,int);
  18. int mulNum(int,int);
  19. int divNum(int,int);
  20.  
  21. int main()
  22. {
  23.     cout<<"Hello World!\n";
  24.     helloWorld();
  25.     int a,b;
  26.     a = 10;
  27.     b = 20;
  28.     cout<<"Addition:"<<addNum(a,b)<<endl;
  29.     cout<<"Subtraction:"<<subNum(a,b)<<endl;
  30.     cout<<"Multiplication:"<<mulNum(a,b)<<endl;
  31.    
  32.     return 0;
  33. }
  34.  
  35. void helloWorld(){
  36.     cout<<"Hellow p0wzxc"<<endl;
  37. }
  38.  
  39. int addNum(int a,int b){
  40.     return a + b;
  41. }
  42.  
  43. int subNum(int a,int b){
  44.     return a - b;
  45. }
  46.  
  47. int mulNum(int a,int b){
  48.     return a * b;
  49. }
  50. int divNum(int a,int b){
  51.     return a / b;
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top