Friday, February 25, 2011

Programming Exercise 1

Tue Feb 01, 2011

 Multiply Two Integers


#include<iostream.h>
main()
{

//Declare variable
int multiply,num1,num2;

//Input num1
cout<<"Enter num1 =";
cin>>num1;

//Input num2
cout<<"Enter Num 2 =";
cin>>num2;

//Formula
multiply=num1*num2;

//Output
cout<<"mutiply= "<<mutiply;
return 0;
}

by: Echelon Tech Group

Weekly Reflection 1

Tue Feb 01, 2011

-1st class , dah dtg lambat.
-dapat rehat 15 minit utk breakfast
-masok je dalam class miss suruh cari group
-aku dapat group dgn ( Mai, Akma, Nash, Bob), 5 org termasok aku.
-then, Introduction chapter 1
-belajar tentang algorithm , pseudo code , flowchart
-algorithm > menggunakan ayat manusia (means tak perlu coding)
-pseudo code > more to coding
-buat weekly reflection : by group
-buat assignment tentang perbezaan antara procedural programming , structured programming and object oriented programming
-buat forum
-kena buat blogspot

Thursday, February 10, 2011

FOP : Chapter 2

Chapter 2 : C++ Basics

The C++ language consist of two elements : Semantics and Syntax 

  • Semantics is a vocabulary of commands that humans can understand and that can be converted into machine language. Table below shows a partial list of vocabulary use in C++ program programming that are also referred to as keywords or reserved word.
  • Syntax is a language structures (or grammar) that allow humans to combine these C++ commands into a program that actually does something.
Example : 

Cout<<”Hello World.”;       (Correct C++ statement) =Correct Syntax
c Output “Hello World”.    
(Incorrect C++ statement) = Wrong Syntax

This are the keywords/reserved word :





asm
do
inline
short
typeid
auto
double
int
signed
typename
bool
dynamic_cast
log
sizeof
union
break
else
mutable
static
unsigned
case
enum
namespace
static_cast
using
catch
explicit
new
struct
virtual
char
extern
operator
switch
void
class
false
private
template
volatile
const
float
protected
this
wchar_t
const_cast
for
public
throw
while
continue
friend
register
true

default
goto
reinterpret_cast
try

delete
if
return
typedef



A simple example C++ program :
#include <iostream>
using namespace std;
 
int main()
{
        cout << "Welcome to the wonderful world of C++!!!\n";
 
        return 0;
}

Here is an example of running the program:
Welcome to the wonderful world of C++!!!

  • A C++ application program is formed by many components that are comments, the include directive and header files, functions, declarations, reserved words, console input/output, escape sequences and statements.




Components
Summary
Example
Comments
Comments are non-executing statements that you add to a program for purpose of documentation.
// One line statements
/* Multiple
   line
   statements */
The preprocessor directive and header file
The preprocessor directive enables the program to use certain functions contained in the external file.
#include <iostream.h>
#include <math.h>


Functions
Functions are the basic building block in C++.
Main()
{
    // Statements
}
Declarations
All variables used in a C++ program must be declared before their use. Variables are simply reference to memory locations.
int x, y, sum;
Reserved words
Reserved words used in the C++ language have special meaning and they cannot be used for any other purpose.
Include, int, main, return
Escape sequences
An escape sequence always begins with the backslash (/) and is followed by one letter or special character.
\n, \t, \\, \”, \’
Console input & output
Data are entered into the computer using cin (console input) and the redirection operator     >>. The function cout and the redirection operator   << sends the output to the system   console.
cout<”Enter a number: “;
cin>>num;
C++ statements
Executable statements in C++ must be followed by a semicolon.
Int x, y, sum;
cout<”Enter a number: “;
cin>>x;
sum = x + y;








Saturday, January 29, 2011

1st Post !!!

1st post aku je aku da x taw aku nk wat ape kat sni .. adoi ! maklomla x pnah buat blog... pastu dsuroh wat blog plak.. mmg la cm serabai nnt. Tp x pe...bg aku...tu sume bkn halangan...ni sume mcm dlu² gak.. mase nk blajar naik basikal..mule² kekok...kayoh x smpai 1 meter...tesembam kat tanah dah..tp lame² pandai la...siap bole buat Willy dr start smpai abes Jmbatan Pulau Pinang..sme je la cm aku wat blog ni...mule² juling itik aku tgk bende² kat dlm ni..tp da lame² aku ngadap,aku godeh sne sni... haish ! mken senang plak..hahaha... lumrah la tu sume kn...

 aku sbrnye bkn suke sgt buat blog ni...aku tgk blog ni lebih kurang cm diari peribadi la gak kn...aku plak, klo wat diari,, sbln skali baru aku update.. tp nk x nk.. Puan Ayuni aq da soh buat utk outcome nnt...tepakse la aku mentelaah blog ni ... ni sume usaha nk lulus FOP .. NO PAIN NO GAIN ! OK..that's all ... post ni just utk mengisi blog aku...nntkn post yg seterusnye~ ADIOS !