CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Oct 2010
    Posts
    15

    Beginner need help with errors

    Need help, errors messages added as comments after line.

    #include <iostream>
    int Add (int x, int y)
    {
    cout << "In Add(), received " << x << " and " << y << "\n"; //Error C2065: 'cout' : undeclared identifier
    return (x+y);
    }
    int main()
    using namespace std; //Error C2143: syntax error : missing ';' before 'using'

    { //Error C2447: '{' : missing function header

    cout << "I'm in main()!\n";
    int a, b, c;
    cout << "Enter two numbers: ";
    cin >> a;
    cin >> b;
    cout << "\nCalling Add()\n";
    c=Add(a,b);
    cout << "\nBack in main().\n";
    cout << "c was set to " << c;
    cout << "\nExiting...\n\n";
    return 0;




    -------------------------------------------------------
    Another question,
    What is code tags and how do use them?
    Attached Images Attached Images
    Last edited by Fnyx; October 26th, 2010 at 06:11 AM. Reason: Code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured