Advertisement
AshfaqFardin

Function Flow

Jul 30th, 2021
1,285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a = 5;
  6.  
  7. int sum(int a, int b){
  8.     return (a+b);
  9. }
  10.  
  11. void greetings(){
  12.     cout << "Welcome\n";
  13. }
  14.  
  15. int square(){
  16.     a = a*a;
  17.     return a;
  18. }
  19.  
  20. int main()
  21. {
  22.     greetings(); // prints Welcome
  23.     int b = 7;
  24.     a = a + sum(a, b); // 5 + (5+7) = 17
  25.     square(); // 17*17 = 289
  26.     cout << a << endl; // 289
  27.    
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement