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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
Thanks for the help.
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;
}