Questions tagged [endl]

For issues relating to the std::endl output-only I/O manipulator.

endl is an output-only I/O manipulator. It inserts a newline character into an output sequence os and flushes the stream. It is defined in the header ostream and part of the namespace std. The behavior is equivalent to calling os.put('\n') and then os.flush().

Minimal example:

#include <iostream>

int main()
{
    std::cout << "Hello World" << std::endl;
    return 0;
}
79 questions
-3
votes
2 answers

symbol endl and cout could not be resolved

I have written this code from a book i am reading but my complier warns be that symbol cout and endl could not be resolved. Why is that. #include #include int main() { cout << "float: " << endl << "stevilo…
Žiga Gazvoda
  • 173
  • 1
  • 9
-3
votes
2 answers

Isn't std::endl redundant?

Flush happens in the following cases: std::cerr std::cin program termination in many implementations, standard output is line-buffered, meaning "\n" flushes anyway So it seems in most regular programs, std::endl is basically unnecessary, but it's…
-3
votes
3 answers

C++ endl outputting a hexadecimal number

After compiling lots of programs with g++, suddenly endl; is exhibiting strange behavior. In addition to a newline, I also get console output of a hexadecimal number. Thinking perhaps I had some memory leak issue I rebooted my Linux Mint Debian…
-5
votes
3 answers

Using 'endl' in C++ programming

first code #include int main() { std::cout << "apple" << endl << "banana"; } second code #include using namespace std; int main(void) { cout << "apple" << endl; cout << "banana" << endl; } Why am i wrong? i…
hyewon
  • 1
1 2 3 4 5
6