Megahalo 0 Report post Posted December 11, 2005 (edited) I just started C++ programming but I understand it a lot!You should use the free bloodshed C++ Program just search google for it.So the tut:Here is the code you will be makingCODE// C++ Tutorial// First C++ Script#include <iostream>using namespace std;int main(){ cout << "Hello World! I'm new to C++ Coding!" << endl;int nothing;cin >> nothing;return 0;}So lets say what this means!CODE// C++ Tutorial// First C++ ScriptThis is a comment line. This when compiled will NOT get put into the programming. This is just for humans who look at the script. I will use these a lot in further tutorials. You can also do /* C++ Tutorial */. This is the exact same thing EXCEPT you can write everything in between and it will comment it. Just don't forget to close the comment or your whole script will become a comment!Next:CODE#include <iostream>using namespace std;This states that I'm including iostream which is something you will need in most programs! You can do the same for files likeCODE#include <hello.h>Which will include the OUTSIDE file hello.h! The next line isCODEusing namespace std;What this says is that I am USING the NAMESPACE std! std is defined in <iostream> so that's why we had to include it. There is a longer way to write this script but we want to teach the EASY way!After:CODEint main()THIS IS SOOOOOOOO IMPORTANT! No program can work without this! This starts the script! With out this NO program would work!The fun part:CODE{ cout << "Hello World! I'm new to C++ Coding!" << endl;Now I had one thing in here that should be in the line int main() description but I'm going to put it here. So the "{" is very important! This tells the program what is in int main()! If ya don't include this again your prog won't work! The same goes for at the end of the script but I'll get to that later.Well so here is the main event! Now you have made the initiation and we can get to the code!CODEcout << "Hello World! I'm new to C++ Coding!" << endl;This is the actuall program! cout is defined in std which is defined in iostream which is defined in the initial C++ coding! The << is saying that the following stuff needs to go into the cout script! "Hello World! I'm new to C++ Coding!" is what will echo on the screen. << again is saying that the stuff before it should enter it. So when you enter << endl you are saying end the line. And at the end of every statement you need a semi colon to tell it to end!What we have covered so far!CODE// C++ Tutorial// First C++ Script#include <iostream>using namespace std;int main(){ cout << "Hello World! I'm new to C++ Coding!" << endl;So the first 2 lines are comments not executed by the program! The next line includes iostream! The next says that we are going to use the namespace std which is defined in iostream. Then the int main() tells the script to start. The { tells whats in the script. cout is defined in the namespace std which is, as I said, defined in iostream. The << tells the stuff after it and before the next one to be executed in the cout. "Hello World! I'm new to C++ Coding!" is what is printed on the screen because it was put into cout. << endl; ends the line and tells that the statement has ended too!Now C++ is so fast it will execute the script and then INSTANTLY close it.To stop this I didCODEint nothing;cin >> nothing;I'm not going to to into what this means in this tutorial but maybe by the next tutorial I will explain it. Include this in your program just to make sure you don't have that problem!Le End:CODEreturn 0;}This is also VERY IMPORTANT! The return 0; says that the script is over and return the code. Also remember that the ; ends the statement.The } is the same as the { right after the int main() line. The int main() said that the script was to start. The { says that this is the begining of what is to be executed in the int main() line and the } says that everything in the int main() script is over and the program is done!Well I've covered EVERY detail in depth!Hope you liked this tutorial! And if ya liked it I hope you'll register on my new coding site when it gets up! Any comments? Just post em here. Did I screw up? Post em here! Is there a bug in your prog that you can't find? POST IT HERE!Cya everyone,Megahalo Notice from BuffaloHELP: Member should learn to use the correct BBcodes. Edited December 14, 2005 by BuffaloHELP (see edit history) Share this post Link to post Share on other sites