Ask your own question, for FREE!
Computer Science 24 Online
OpenStudy (blackstreet23):

Does somebody knows how to do the program "Hello World" on Dev C++ 5.8.3 #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { return 0; } I tried to do follow the steps of the video, but i do not know how to start.

OpenStudy (turingtest):

so where did you write this code?

OpenStudy (turingtest):

in a text file or what?

OpenStudy (blackstreet23):

I did not write it. It comes by default

OpenStudy (blackstreet23):

project

OpenStudy (turingtest):

you downloaded an application, right? And when you open it you see this code?

OpenStudy (turingtest):

did you download Dev C++ 5.8.3 ?

OpenStudy (blackstreet23):

yes

OpenStudy (turingtest):

and you open it and see that code?

OpenStudy (turingtest):

is there a "run" button? can you send a screenshot?

OpenStudy (blackstreet23):

i did not really see it

OpenStudy (turingtest):

can you send a screenshot maybe?

OpenStudy (blackstreet23):

yes

OpenStudy (blackstreet23):

give me a second

OpenStudy (blackstreet23):

OpenStudy (blackstreet23):

Can you see it well?

OpenStudy (blackstreet23):

In which part of this pdf can i find it?

OpenStudy (ellecullen):

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

OpenStudy (blackstreet23):

I think you do not use print in C++

OpenStudy (turingtest):

what happens when you hit the "execute" button?

OpenStudy (blackstreet23):

it runs

OpenStudy (blackstreet23):

yeah but how do i make it say "Hello World"?

OpenStudy (turingtest):

i think you can just do ``` #include <iostream> int main(void) { cout >> "Hello World!" >> endl; return 0; } ```

OpenStudy (blackstreet23):

what does endl;, means?

OpenStudy (blackstreet23):

Do you always need to end with semicolon?

OpenStudy (turingtest):

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.

OpenStudy (turingtest):

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; } ```

OpenStudy (blackstreet23):

ohh ok thanks.

OpenStudy (blackstreet23):

So if you just put semicolon without including endl it prints in the same line?

OpenStudy (blackstreet23):

even though the elements may be in different lines?

OpenStudy (blackstreet23):

sorry i am an extremely new learner of c++

OpenStudy (turingtest):

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

OpenStudy (blackstreet23):

ohh hey btw your code gave me this error

OpenStudy (turingtest):

yes I wrote the streams backwards they should go `<<` not `>>` my mistake

OpenStudy (turingtest):

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; } ```

OpenStudy (blackstreet23):

ohh cool it worked !!!

OpenStudy (blackstreet23):

btw why you changed int main(int argc, char** argv) for int main(void)?

OpenStudy (turingtest):

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.

OpenStudy (blackstreet23):

ohh ok thanks a lot!!!! you are the best!!!!

OpenStudy (turingtest):

welcome, happy to help!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!