Sum function

Why this code is not working ?

#include <iostream>
using namespace std;
int sum(int a, int b) // int add_two_integers(int value_one, int value_two)
{
return a+b;
}

int main()
{
cout << sum(10, 5)*2;
return 0;
}
Last edited on
What error are you getting?
your code is fine.

http://cpp.sh/6w5z

if you want to see it working just add a pause before return 0.

1
2
int pause;
cin >> pause;
thank u very much

q: where I add the code u gave me ?
I put it like the following :

#include <iostream>
using namespace std;
int sum(int a, int b) // int add_two_integers(int value_one, int value_two)
{
return a+b;
}

int main()
{
int pause;
cin >> pause;

cout << sum(10, 5)*2;
return 0;
}
it should be working.
I will check enshallah

Anyhow
thank u 4 your effort
Topic archived. No new replies allowed.