Sum function

Dec 27, 2014 at 3:43pm
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 Dec 27, 2014 at 3:43pm
Dec 27, 2014 at 4:06pm
What error are you getting?
Dec 27, 2014 at 4:07pm
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;
Dec 28, 2014 at 8:23pm
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;
}
Dec 29, 2014 at 9:09am
it should be working.
Dec 29, 2014 at 5:45pm
I will check enshallah

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