• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Standard C++?

foo2thabar

Well-Known Member
NLC
Hey,

I was messing around with a simple C++ program just to make sure I still knew some C++, and I noticed that it wouldn't compile with a couple of elements present.

Is the first line or the second line standard C++? GCC wouldn't compile with the first line, but was fine with the second one.

Code:
std::cout<<endl;
std::cout<<"\n";

And is the <string> header standard? Dev-C++ had it, but GCC doesn't like it.
#include <string>

Thanks!
 
Since C++ Standard Template Library (STL) consists string header (through declaration #include <string>), you should be able to use it both in Dev C++ and GCC

std::cout is a part of <iostream>.
if you found that "endl" was not worked with std::cout, why not using linefeed ("\n") instead? you have to notice that there is a slight difference between windows and unix linefeed (\r\n and \n). since "endl" is a common newline declaration for windows env, it is unavailable in unix.
 
Back
Top