[ create a new paste ] login | about

Link: http://codepad.org/N34y39dj    [ raw code | output | fork ]

C++, pasted on Sep 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//#include <stdafx.h> // Visual Studio users need to uncomment this line
#include <iostream>

// add takes two integers as parameters, and returns the result of their sum
// add does not care what the exact values of x and y are
int add(int x, int y)
{
    return x + y;
}

int main()
{
    using namespace std;
    // It is the caller of add() that decides the exact values of x and y
    cout << add(4, 5) << endl; // x=4 and y=5 are the parameters
    return 0;
}


Output:
1
9


Create a new paste based on this one


Comments: