c++ - "Use of plus() is ambiguous" error -


i trying write function takes 2 numbers , prints out sum.

#include <iostream>  using namespace std;  int plus(int, int);  int main () {  int a, b, result;  cout << "2 numbrs";  cin>>a>>b;  result = plus(a,b);  cout << result;  return 0; }  int plus(int a,int b) {  int sum;  sum = a+b;  return sum; } 

and error get:

use of `plus' ambiguous 

it´s first c++ program , in fact getting blind finding error.

either do

result = ::plus(a,b); 

or rename function. lesson on why using namespace std not considered practice.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -