forums | blogs | polls | tutorials | downloads | rules | help

Add new comment

[Tut.] C++ : Making your first console window

Ok it seems alot of people are interested in taking up c++ to make dlls for ds2 , here is a small tut. to get you started with c++

to get Dev C++ compiler : http://www.bloodshed.net/download.html

Open Up whichever Compiler you will be using (i use ms visual c++).
Create a new console Application (win32 is the same as a console application)

If the following Code is not in your Starting code already then put it in

#include <stdlib.h>
#include <iostream.h>
#include <string>
using namespace std;

int main(int main(int argc, char *argv[]))

{
system("PAUSE");
return 0;
}

Ok now go to the first Bracket and hit enter twice to start a line under the bracket.

then Type the following

cout << "hello i am your computer talking" << endl;

Now your code should look like this

#include <stdlib.h>
#include <iostream.h>
#include <string>
using namespace std;

int main(int main(int argc, char *argv[]))

{

cout << "hello i am your computer talking" << endl;

system("PAUSE");
return 0;

}

Now all you have to do is Build and compile then run it and a dos window should appear saying

"Hello , I am your computer talking"

Summary :

the command 'cout' tells the computer that you want to output some data through the console.

The 2 less than sign following the cout tell the computer that the thing that follows will be shown on the console.

The double quotes are to tell the computer where the string will start and end.

And Endl; means that you want to start a new line.

Hope this helped Some of you soon-to-be programmers on your way of learning, I will Be making a tutorial soon on how to make the console add,substract,multiply or divide numbers.

-Dan