Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

C++ Error C2065 - What am I doing wrong?

I am trying to compile this and I am keeping getting Error C205 on Line 15 and Line 16. I am new to C++ Please help :(

#include <iostream>

int a;

int b;

int c;

int d;

int test(int,int);

void main()

{

a=1;

b=2;

c=3;

d=4;

cout << test(a,b) <<endl;

cout <<a <<b <<c <<d <<endl;

}

2 Answers

Relevance
  • ?
    Lv 7
    1 decade ago
    Favorite Answer

    1 - Either add the "using namespace std;" directive immediately after the #include or as the first statement of main() or change the cout and endl statements to std::cout, std::endl.

    2 - You defined a function prototype (int test(int,int)), but forgot to include the actual function test(), called by cout << test(a,b)...

    Following the } on your program there should be a function that looks like this:

    int test(int a,int b)

    {

    Your code here...

    return x; // x is a return value defined within the function

    }

Still have questions? Get your answers by asking now.