Saturday, January 24, 2009

Other Blogs

Learning Computer Programming
A very good blog for learning some good languages like C++, HTML, JavaScript etc. The blogger writes very good material and explains the code very well. Perfect for beginners and amateur programmers.

Smart Programming
Cool blog which helps solving programming problems as well as other computer software problems.

Saturday, January 17, 2009

Lesson 2: Input and Output

Level: Beginner

In this lesson we will discuss taking input from the user and giving output to the user in C++. Remember that if you know these basics you can skip them.

We will later be programming using a software called 3D GameStudio. Please click here to download a free trial version of 30 days. Its around 50MB. You have to buy the software if you want to make commercial games with it.

As I have told you in Lesson 1 that you have to include the files 'iostream.h' and 'conio.h' if you have to use input and output in your program.

The command for input is 'cin' followed by '>>' and then followed by the name of the variable you wish to store the input in. 'cin' stands for console in.

The command for output is 'cout' followed by '<<' and then followed by what string you want to print on the screen. 'cout' stands for console out.

Click here to download an example.

In the example, we first include the files 'iostream.h' and 'conio.h'. Then, we start the main function. Then, we introduce characters named as 'name' (command: 'char') followed by []. [] brackets mean that the user can enter infinite amount of characters. If you want to limit the user, you can write some value in it. After that, we give an output to the user to write his/her name, which is stored in value 'name'.

Then, the screen is cleared and output is given.

Friday, January 16, 2009

Lesson 1 Download

I have uploaded the code for lesson 1. It is a text file. I had to upload it since blogger did not let me write code in C++. Anyway, the download link is given below. I'm afraid you will have to see the explanation from lesson 1 post in this blog. Thanks!

http://www.4shared.com/file/80893345/67a959e0/helloworld_C.html

Friday, January 9, 2009

Sorry for the last post

Blogger doesn't let me write some things in C++. I will try to solve this problem or I will post a text file. Screw Blogger!!!

Monday, December 8, 2008

2D Game Making Resources

Level: Beginner

If you are familiar with C++ or know programming in C++, you can skip this tutorial.

Beginners always think higher and most of them just want a software that makes the perfect 3D game for them. That is IMPOSSIBLE, you can have my word for it. To make a perfect game, you always need to start from the first step. The first step in game making is to make a simple "Hello World" program.

You must have heard people say that BASIC or JAVA are the perfect languages for beginners. We will get to them later but for now we will focus on C++.

Tools Needed:
- Any C++ IDE (Integrated Development Environment) RECOMMENDED: Turbo C, C-Free, Microsoft Visual C++ (Click on the links to get the download).

I would recommend using Turbo C because I have not found a more simple IDE specially for a language like C++. And anyways it is lighter than the other two. So, I will be teaching from the Turbo C point of view.

Download and install Turbo C and open up (installation directory)\BIN\TC.exe. You will see a blue window with a grey one at bottom. The blue window is the editor where you write all your code. The grey one is the status window which shows you what the Turbo C engine is doing and what it has done.

Write down the following code (please don't copy and paste if you are serious about C++ programming). The lines are explained step by step at the end of the code. Write this code without the double quotes!

"//START
#include
#include

void main()
{
cout<<"Hello World!"<
cout<<"This is another line.";
getch();

}

//END"

Lets get to the explanation. The first line of the code that you see is //START. This line starts with two slashes i.e. //. These two slashes mean that the words after them (in the same line) are collectively a COMMENT. This means that the Turbo C engine (or any other that you are using) will ignore them. These are written so that readers of your script can get a better understanding of the code.

The next two lines use the word "#include". These are used when you want to include another file's code into your program to make your programming easier using pre-defined keywords (functions defined in the files you include). These files are called headers and they contain pre-defined keywords for you to use. These are included in the (installation directory)/include. In this program, "iostream.h" and "conio.h" are included, These two must be included in every program that is designed to get an input from user (more about that later) or to print output on the screen.

"void main()" simply means the main function of the program when it is executed. All programs must contain this because it is the root of all the functions of the program.

The curly brackets "{}" are used to enclose the code for a function, in this case the "main()" function.

'cout<<"Hello World!"' means to give the output "Hello World!" on the screen. "endl" means end line which is used to end the line to write the new string to the next line. "getch()" stands for get character. It is used for making the program wait before performing the next order till the user presses a key. Otherwise, the program just keeps executing the code without any pause. Well that's our first program in C++ for absolute beginners. If you have any problems, please write a comment on the topic. I will try my best to solve your problem. See you in the next tutorial.

Introduction

Hello, I am DeeJay. I am a hobbyist programmer and I have experimented with different software and languages. I am planning for taking up a computer programming career.

Enough about me, lets talk about this blog. I have created this blog for hobbyist programmers like me. The blog entries will be written in simple English and no special "Chat" English like u for you or plz for please.

I request all the people who plan to write comments or suggestions to use simple English.

I will write tutorials in the blog, give you people links to resources and required stuff and I will also give you some freeware things like models, examples, scripts etc. when and where they are required.