Menu

I am stuck with Dev C++ Version 4.9.9.2

2007-08-17
2012-09-26
  • Gear_Shifter

    Gear_Shifter - 2007-08-17

    I have the following code and keep getting the the same error

    include<iostream>

    int main()
    {
    int x = 5;
    int y = 7;
    std::cout << endl;
    std::cout << x + y << " " << x * y;
    std::cout << endl;
    return 0;
    }

    The error says

    'endl' undeclared (first use this function)

    I have no clue what this means because I am very new to C++, the code is from a book I am trying to learn from.
    I am Using Dev-C++ version 4.9.9.2 on Windows XP.

    I tried too look through the FAQ's but didn't see anything, if i missed it please let me know lol

    Thanks For the Help

     
    • Gear_Shifter

      Gear_Shifter - 2007-08-18

      Thanks for the help.

       
    • Wayne Keen

      Wayne Keen - 2007-08-17

      See if you can tell me why the code below compiles. :)

      When you say std::cout - you are telling the compiler that cout can be found in
      the "std" or standard namespace. You failed to do this for endl, and it did not
      know where to find that name.

      Note also that you are probably going to want to add some code the keep the display
      window open - directions on how to do this - and many other things can be found
      in the thread "Please Read Before Posting a Question"

      include<iostream>

      int main()
      {
      int x = 5;
      int y = 7;
      std::cout << std::endl;
      std::cout << x + y << " " << x * y;
      std::cout << std::endl;
      return 0;
      }

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.