function error.

Write your question here.
I have just started learning C++ .This is my first function ,I am not sure what i am doing wrong that i am getting wrong answer.Please help!!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  #include <iostream>
#include <string>
#include <sstream>
using namespace std;

int addition()
	{
		int a;
		int b;
                int c;
		int d;
		a=8;
		b=10;
		c = 10;
		d =a+b+c;
		return d;
	}
int main ()
{
	cout << addition;
}
To call the function you need to put parenthesis after the function name.
 
	cout << addition();
Last edited on
Thanks Sir,
really appreciate your help .I spent almost two hour to figure this out. lol
Topic archived. No new replies allowed.