10
raulqf
7y

#include <iostream>

using namespace std;

int main() {
cout << "Hello world" << endl;
}

If it works, It's time for a coffee break!! :)

Comments
  • 3
    Don't use "using namespace std;" :(
  • 1
    And '\n' is faster than endl
  • 1
    @Alvancaran But \n won't flush the stream :)
  • 0
    Haha!! Nice!
  • 0
    @novopl that depends, stdout is newline buffered, so it actually will flush on every \n
  • 2
    The missing return bugs me.
  • 0
    @fdgram why? Sorry, I really dont do cpp, but I am in a cpp class right now
  • 1
    @Crazed you're putting the entirety of the standard library into the global namespace. Why have namespaces if you're not gonna use it?
    The standard library has a lot of very generic names, array, list, vector, swap, min, max, what have you. You will inevitably get collisions with other libraries and your own code.
    Additionally it makes the code harder to read as you won't know where a function or class comes from. Is this a std vector? Or a geometrical vector?
  • 0
    @fdgram ah ok, see I'm web dev so i wasn't actually sure how the namespace thing worked lol. Essentially its like including jquery for a single finction then
  • 0
    @Crazed nope. More like throwing all your plates and cutlery around the entire house instead of keeping them nicely isolated in the cupboards and drawers.
  • 1
    @fdgram ima stick with JS :)
  • 1
    I miss C++
Add Comment