I am not sure what I am doing so wrong. Please help.

#include <iostream>
using namespace std;
int addition(int x, int y, int z);
int main()
int x,y,z;
int main(){
    cout << "Type a number. ";
    cin >> z;
    cout << "Type another. ";
    cin >> x;
    z = x+y;
  cout << "The two you added is " << z << "\n";
}
int addition(int x, int y, int z);
{
  return z=(x+y);
}

delete line 4. It is not necessary to prototype main() as it is a special function. And there is no semicolon at the end of that line.

line 3 int addition(int x, int y, int z);
should be changed like this addition(int, int, int);

and delete line 4

line 3 int addition(int x, int y, int z);
should be changed like this addition(int, int, int);

No, either way is correct. Function prototypes can have either named or unnamed argument list.

hi , the program/code is fine if u remove the line 4. Need some change in line 14 remove semi colon then its work fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.