Wednesday, 18 January 2012

First class of C Programming

Yesterday, Dr.Zul ask me to join his programming class so I can learn more about programming. He said, actually on Monday is the first class but I'm on leave. So, I have left behind a class but it doesn't matter at all, I can learn slowly. In the class, I have learn how to swap the program, then compute because an important reason for using a computer - very fast calculation.
Arithmetic instruction format:
var = <var/const><arithmetic operator><var/const>
Among the arithmetic operators are:
+, -, *, /(division), %(mod)
Any formula can be translated into the arithmetic instruction format.
Computer can also make decision. We use keywords if, if-else, if-elseif, switch.
Conditional statement format:
<var/const><conditional operator><var/const>
where the conditional operators are:
>, <, >=, <=, == (equal), !=(not equal)
and the result of the conditional operation either 0(false) or 1(true). In fact, other than 0 is equal to true.

Using if statement:
*If using only one statement, use semicolon. If more tahn one statements, use block.Then, no need semicolon.

Using switch statement:
*no semicolon after the block
*without break, then if ans== Yes, the computer will print both Yes, No and Others.

Equivalent using if-else.

0 comments: