locked
Error RRS feed

  • Question

  • #include<iostream>
    using namespace std;
    int main ()
    {
        cout<<"Hello World. ">>
            return 0;
    }

    error c2059 :syntax error :'return'

    Friday, September 12, 2014 12:19 PM

Answers

  • In C++, you end a line using a ';' and not the >>, >> are used to get the value from the User.

    #include<iostream>
    using namespace std;
    int main ()
    {
        cout << "Hello World. ";
        return 0;
    }

    ..this will do it. The error was, because you were not ending the line. In C++ it is necessary for you to end the lines, and ';' ends a line for you to start the next command. 

    "error c2059 :syntax error :'return'" means that the compiler was expecting some other token, and not the return keyword. 


    ~!Firewall!~


    Friday, September 12, 2014 2:06 PM

All replies

  • This is not code that could be found on Access for Developers...

    For what it's worth I think you meant to write:

      cout<<"Hello World. ";
        return 0;

    Friday, September 12, 2014 2:04 PM
  • In C++, you end a line using a ';' and not the >>, >> are used to get the value from the User.

    #include<iostream>
    using namespace std;
    int main ()
    {
        cout << "Hello World. ";
        return 0;
    }

    ..this will do it. The error was, because you were not ending the line. In C++ it is necessary for you to end the lines, and ';' ends a line for you to start the next command. 

    "error c2059 :syntax error :'return'" means that the compiler was expecting some other token, and not the return keyword. 


    ~!Firewall!~


    Friday, September 12, 2014 2:06 PM
  • Hi,

    This forum is to discuss problems of Office development such as VBA, VSTO, Apps for Office .etc. But I think your question is not related to the topic of this forum. If all the replies above cannot help you, I suggest you posting it in proper forum based on your developing language for more efficient responses.

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 15, 2014 3:09 AM