what dose flushing the buffer ezactly mean please explain like very simply im really confused also what are the uses of flushing a buffer(whatever it means pls tell me what it means) and do professional programs use std::endl or /n
also i got a error for a very simple programme here is the code (tell me what i did wrong)
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
int main ()
{
std::cout << "Test" <<std::endl;
std::cout << "new" <<std::endl;
return 0;
}
What did i do wrong i use two ostream objects ending it with endl but when i change it to /n it somehow works
it does execute but shows a blank with a error code saying returning bunch of numbers
i appreciate anyone who is even bothering to click on this post it still means a lot :) have a good day programmers
Flushing output buffer means that stream content will be forced to be writthen to disc/output to screen/sent to the net.
So if you use endl (or just .flush()), your text will be shown on screen in any case. Otherwise it will be output when your library decides so.
also i got a error for a very simple programme
Your program is working. Tell exactly, what error says.
instead of putting std:: in front of everything, just put this
Do not do that if you thinking about getting a job in IT. In medium to large projects you are almost guaranteed to run into problems with using directive.
It will be output when your library decides it is time. Usually it happens before reading from stream, when buffer is full and from time to time. Many manual flushes will slow down program, because it will not be able to make use of advantages of buffered input.
I have answered your PM.
If I got your question right, you might find helpful these online language references: http://www.cplusplus.com/reference/ http://en.cppreference.com/
They contain information about language features and standard library. Also you might want (after you finish with beginner level stuff) to get a copy of C++ standard. It is basically is a description how language should work. It is very hard to read nad it is better to not try to read if you don't yet get hold of C++.
That depend. If you would want to learn C after you good In C++, go for it. It will help you to understand low-level stuff. If you will decide to move to higher level languages, that is fine too. It is too early to think about that.