Welcome to DrDanielCS.net |
|
||
|
|||
Home | News | void |
|
||
External Links My How To Pages Other Void |
Program with C++ |
||
To write
a program with C++ (the most powerful programming language), you will need
only a compiler and knowledge of how to use it. There are three popular free
compilers available, each of which with their own negative attributes, first
is GNU C++, it is very difficult to install, and can only compile console
(text based) programs, second is Dev C++, I recommend this for beginners
since it has full windows functionality and is very easy to install, it is
effective and easy to use, I just don’t prefer it, because of its Windows 95
like theme. My personal favorite is MS Visual C++ Express Edition, however it
is difficult to install and the programs made with it aren’t easily
transferred to other systems, esp. other operating systems. I recommend
downloading and installing Dev C++, I have used it with no viruses or other
problems; however I am not responsible for damage caused by any program or
tutorial on this site, use at your own risk. This tutorial will be made and
tested with Dev C++ that can be downloaded from this site. Download
Dev C++ - Run and Install, just keep clicking next To get
started, go to –File –New –Project –Click Console App & Name Your Project
–OK –Save On
the left-hand white box double-click Project, then main, delete the text and
type this: #include <iostream> using namespace std; int main() { cout <<"Game
Over!\n\n"; system("PAUSE"); return 0; } Go to
–Execute –Compile & Run Now
You Have A Very Simple Program That Says “GAME OVER!”!!! And
Now For The Explanation #include <iostream> - really don’t know, just
that certain include files such as “iostream” allow your program to do
certain things. Use “iostream” for input/output, “math” for calculations. using namespace std; - tells the compiler what include library to use, in this
case std (standard). int main() – a function, used to organize the program, everything
between the brackets is the “main” function { cout <<"Game Over!\n\n"; - send
the text “Game Over!” to the screen “\n” is like pressing the ENTER button system("PAUSE"); - remove this and see
what happens, your program will run, but you will never see it because it
will close before you see the text, basically this tells “system”(Your
Program) to PAUSE and wait for input. return 0; - tells the computer that the function
“main” ran successfully, look at “int” in front of main(), this is a
variable, now that variable is equal to 0, when main equals 0 the computer
knows that the program ran successfully. } Now,
if you like programming and being a nerd you can experiment with this code,
also if you understand this then you will recognize the source code of any
major application, Windows’ OS, any Xbox Game, PS2/3 Game, you name it,
everything is written in either C, C++, C#. However, internet source code is
what you see on MySpace, it is either Java or HTML. C++ is much more complex,
faster, and more powerful. More advanced code and tutorials to come. If you
have any problems or comments, I’d be glad to hear from you on myspace or e-mail. |
|||
- |
©3001-3009 No one. Rights to kick your ass if you steal my idea reserved. |
||