OK, so I'm sitting here bored with nothing else to do, this is for those of you who wish to create your first C++ application.
the first program anyone learns to write is called "Hello world", this consists of printing the text "Hello world" to the screen in a console.
OK, for people who are using windows based operating systems i suggest you get a C++ compiler called bloodshed Dev C++, don't fuss with fancy things like visual studio and such.
a compiler will link and compile your code into a language the machine can understand and in windows you will create a .exe file that will run your program.
-STEPS-
1)so lets get started, in bloodshed create a new console application, name it whatever.
2)bloodshed will set up your basic console application, it will include <iostream> which is your Input/Output stream class (sending input from another source EX. keyboard, and the output is where your sending it to, in this case it will be the screen.) don't worry about the rest yet. all you need to know is that in this example the input will be what we write in the code, and the output will be onto the screen.
3)you should have something similar to (I'm going off strictly memory here)
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
ok, main is going to be loaded first (its the only thing we have right now) anything between the { and the } is your main function. we will get into functions later.
we are going to use cout (this is an output to the screen command).
double carrots specifies which way the information is going, and anything between quotes is thought of as a string.
so
cout<<"Hello World";
this is saying send the string Hello World to the screen.
the finished code will look something like this.
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout<<"Hello World";
system("PAUSE");
return EXIT_SUCCESS;
}
tell me if it compiles lol.
-Symantic