Does somebody knows how to do the program "Hello World" on Dev C++ 5.8.3
#include
so where did you write this code?
in a text file or what?
I did not write it. It comes by default
project
you downloaded an application, right? And when you open it you see this code?
did you download Dev C++ 5.8.3 ?
yes
and you open it and see that code?
is there a "run" button? can you send a screenshot?
i did not really see it
can you send a screenshot maybe?
yes
give me a second
Can you see it well?
In which part of this pdf can i find it?
Hey guys, if this is C++, then you are doing the right thing. I suggest using a search engine and looking up special tutorials with examples on how to write a specific program such as "Hello World." I took a C++ course in my sophomore year. def function(): print (x) """ def function(): \t print(x)""" so you can use this example I was given when I took a similar course. Elle
I think you do not use print in C++
what happens when you hit the "execute" button?
it runs
yeah but how do i make it say "Hello World"?
i think you can just do ``` #include <iostream> int main(void) { cout >> "Hello World!" >> endl; return 0; } ```
what does endl;, means?
Do you always need to end with semicolon?
endl; means "end line" and creates a newline character (\n), which is the same as hitting return on your keyboard. If you don't put endl; you won't get a new line for each thin you print. Try ``` #include <iostream> int main(void) { cout >> "Hello World!" >> endl; cout >> "I am Learning C++!" >> endl; return 0; } ``` versus ``` #include <iostream> int main(void) { cout >> "Hello World!"; cout >> "I am Learning C++!"; return 0; } ``` The semicolon tells the compiler (the thing that translates your code to 0's and 1's) that the line of code you were writing is finished, and that it needs to move on to the next line of code. Forgetting to put a semicolon can cause your code to throw an error, or much worse, to run differently than you expect without telling you there was a mistake!So yes, the semicolon is very important in languages like C++, but newer languages like Python don't have that.
Oops I wrote the streams backwards ``` #include <iostream> using namespace std; int main(void) { cout << "Hello World!" << endl; cout << "I am Learning C++!" << endl; return 0; } ``` ``` #include <iostream> using namespace std; int main(void) { cout << "Hello World!"; cout << "I am Learning C++!"; return 0; } ```
ohh ok thanks.
So if you just put semicolon without including endl it prints in the same line?
even though the elements may be in different lines?
sorry i am an extremely new learner of c++
yes, if you don't put either `endl;` or the newline character `\n`, everything will print on the same line, regardless of where the lines of code are
ohh hey btw your code gave me this error
yes I wrote the streams backwards they should go `<<` not `>>` my mistake
oh I see, you also put `int main(void)` inside `int main(int argc, char* argv)` you can only have *one* `main` function per program the only code you should have on your screen is ``` #include <iostream> using namespace std; int main(void) { cout << "Hello World!" << endl; cout << "I am Learning C++!" << endl; return 0; } ```
ohh cool it worked !!!
btw why you changed int main(int argc, char** argv) for int main(void)?
Because it is simpler, and you aren't using the `argc` or `argv` parts. You will learn what those do later (they are for command line arguments), but the first twenty programs you write will not involve command line arguments, so that code is unnecessary.
ohh ok thanks a lot!!!! you are the best!!!!
welcome, happy to help!
Join our real-time social learning platform and learn together with your friends!