So I am a complete beginner in C++. I am following the book C++ primer. The author always uses std::endl after every std::cout statement to flush the buffer. My quesion is should I always use std::endl?
#include<iostream>
int main()
{
int sum=0,val=1;
while(val<=10)
{
sum+=val;
++val;
}
std::cout<<"Sum of the 1 to 10 is: "<<sum<<std::endl;
return 0;
}