Thursday, 21 June 2007

Variable Type in C

There are 4 basic types of variable in C; they are: char, int, double and float.
Type name Meaning
char The most basic unit addressable by the machine; typically a single octet. This is an integral type.
int The most natural size of integer for the machine; typically a whole 16, 32 or 64 bit addressable word.
float A single-precision floating point value.
double A double-precision floating point value.

New learner (that is never make any program yet) may be does not understand about this type.
We will learn step by step about programming.
We will use C/C++ programming language.
Now, u can search and download it.

Wednesday, 20 June 2007

Variable

Are u sure to learn algorithm ?
of course, right ?

Now, we have to know about variable.
Before, i give u an example about how to make a cup of coffee.
In that algorithm, i placed some variable like sugar.
No, i think sugar is not a variable, but type of variable.
An example, there is sugar named "sugarA".
"sugarA" is a variable that has type sugar.
Variable have a value.
What the value of "sugarA" ?
e.g. sugarA have value 100mg.

To learn algorithm, we have to know about variable.
There are many types of variable in programming language.
Some of them, like, integer (numeric type), string (character type/alphanumeric), boolean (true or false) and so on.
I will give u various types of variable in C/C++ programming language.

Friday, 15 June 2007

What is algorithm ?

First i knew algorithm, i thought that was logarithm.
Of course not.
That is very different.
In wikipedia, an algorithm is a finite list of well-defined instructions for accomplishing some task that, given an initial state, will terminate in a defined end-state.

Lets i give u an example.
I wanna make a cup of coffee.
First, i must give an initial-state and end-state.
Initial-state : there are a cup, sugar, coffee, hot water, coffee cream, a spoon, and a kitchen table in the kitchen. there is an coffee table in my rest room.
End-state : delicious coffee, yeah i want it so much.
What's the algorithm?
Like definition of algorithm above, algorithm is a finite list of well-defined instruction.

Algorithm :
- walk to kitchen (watch out if the floor is wet)
- get the cup and take it on the kitchen table.
- get the spoon, mix the coffee (about 15mg) with some sugar (depend on u) and coffee cream (sufficiently).
- fill the cup with hot water (don't spill it) and keep mix the coffee. (mmMmmmMmm...)
- get the cup, walk into my rest room, and enjoy my delicious coffee.

The algorithm can be different from another person ofcourse.
U can make ur own algorithm.
Just try it.
This is just an opening...... ;)