I'm still learning C++ but this has one too many errors that I have to correct this.
#include <iostream> //<iostream.h> is non-standard and is no longer supported on all platforms //using std::cout; if you want to use "cout" instead of std::cout
int main() { std::cout << "Hello World!\n"; //spacing and \n just to make it beautiful to see return 0; //you need to return 0 for int main function }
I'm still learning C++ but this has one too many errors that I have to correct this.
#include <iostream> //<iostream.h> is non-standard and is no longer supported on all platforms //using std::cout; if you want to use "cout" instead of std::cout
int main() { std::cout << "Hello World!\n"; //spacing and \n just to make it beautiful to see return 0; //you need to return 0 for int main function }
Weird, guess I'm behind on C++ standards. I've never used :: in a program. This was perfectly fine back in middle school.
Weird, guess I'm behind on C++ standards. I've never used :: in a program. This was perfectly fine back in middle school.
It's because you didn't use a namespace in your snippet (i.e. using namespace std;). When you don't do that, you have to explicitly tell the compiler where something comes from; "std::" tells the compiler that the following identifier comes from the std namespace. You can also have to do this when there are conflicting identifiers coming from different namespaces.
I'm sure everyone knows the joke about C and the sexually transmitted diseases, so I'll aim for the one about the eyes.
Q: Why do Java developers often wear glasses? A: Because they can't C#!
Anyway, how many languages can we do a hello world! in? Personally, I count for three: Java, PHP, JS (both into DOM and console), discounting things like Bash and HTML. My C is very rusty and low-grade, though, even the namespacing was news for me.
Why would a flush would be useful in this case? You're not trying to synchronise anything.
Maybe not in a normal OS, but could be useful if you're progamming on an embedded system. For example, making sure the serial buffer all transmitted before moving to the next instruction.
Yeah I tought you meant that, but I wanted to take the opportunity to show you guys that github repo.
You managed to stop productivity at my company for a good half-hour until the guys went through the more interesting ones. Like the time I linked "Best comments in code" from StackOverflow in the dev chat.
You managed to stop productivity at my company for a good half-hour until the guys went through the more interesting ones. Like the time I linked "Best comments in code" from StackOverflow in the dev chat.
Congrats :)
Thanks, but dang, what are you doing browsing danbooru at work? Not that I worry or really care (well I sort of do), but that's weird; sorry if that sounds rude.
Thanks, but dang, what are you doing browsing danbooru at work? Not that I worry or really care (well I sort of do), but that's weird; sorry if that sounds rude.
We have a very relaxed work environment, and I generally arrive one-two hours before anyone else so that I have some free time to use in any way I want. Generally, it boils own to polishing a few features on some of our internal apps, running a deployment, maybe writing up test cases, but that day, I happened to check if my comments received responses, saw yours, and started browsing. Then, I linked it in the developers' chat, as a bit of curio, aaand ... yeah.
Plus, my screens happen to be angled so that it's very difficult to see them unless you try. And everyone knows I'm into anime and Touhou - in fact, almost all of our developers have an appreciation for anime. Which itself is a weird coincidence.
We have a very relaxed work environment, and I generally arrive one-two hours before anyone else so that I have some free time to use in any way I want. (...)