Wednesday, March 30, 2011

step 1 :

step 2 :


step 4:



 siap assignmnt 2..
Alhamdulilah....

Tuesday, March 29, 2011

ASSIGNMENT 1

QUESTION :
Write a program :
* * * * * * * * * * * * * * * * *
M E S I N T I N M I N U M A N
- - - - - - - - - - - - - - - - -
Jenis                                   RM
- - - - - - - - - - - - - - - - -
1.Pepsi                               1.80
2.Coca Cola                       1.90
3.F&N Orange                  1.50
4.F&N Mirinda                 1.60
5.100 Plus                       2.00
* * * * * * * * * * * * * * * * *
your selection :
Insert your money :

*Your Balance are ________
* Please insert _________ . Your money is not enough !! : _________

Thank You !
Please Come Again

ANSWER :
Step 1 :

       

Step 2 :
       

Step 3 :
       

Step 4 :
       

Steap 5 :
       

Step 6 :
       

Step 7 :
            

Step 8 : ( bile masukkan duit lebih dpd harga asal )
       

Step 9 :
       

Step 10 :
       
      
Step 11 :
       

Step 12 :
       

Step 13 :
       

Step 14 : ( bile masukkan duit kurang dpd harga asal )
       

Step 15 :
       

Step 16 :
       

Step 17 :
       

Step 18 :
       

Step 19 :
       

homework......

QUESTION 1
a) Initializing variable Pi with the value 3.14
    const Pi=3.14;

b) Declare a variable named perimeter with double data type
    double perimeter;

c) Give instruction that allowed user to input data
    cout<<"Enter data=";
    cin>>data;

d) Input number of computer using variable
    cout<<"Enter number=";
    cin>>nimber;

QUESTION 2
Change the if...else statement below to switch...case statement
#include<iostream.h>
main()
{
int selection,quantity;
float price;
cout<<"1.pen=rm0.50";
cout<<"2.pencil=rm0.30;
cout<<"3.ruler=rm0.20";
cout<<"4.Erasor=rm0.10";
cin>>selection;
cin>>quantity;
if(selection==1)
{price=quantity*0.50;}
else if(selection==2)
{price=quantity*0.30;}
else if(selection==3)
{price=quantity*0.20;}
else if(selection==4)
{price=quantity*0.10;}
else
{cout<<"Invalid selection";}
cout<<"the price is :"<<price;
return 0;
}

#include<iostream.h>
main()
{
int selection,quantity;
float price;
cout<<"1.pen=rm0.50";
cout<<"2.pencil=rm0.30;
cout<<"3.ruler=rm0.20";
cout<<"4.Erasor=rm0.10";
cin>>selection;
cin>>quantity;
switch(quantity,selection)
{
case 1:"price=quantity*0.50";break;
case 2:"price=quantity*0.30";break;
case 3:"price=quantity*0.20";break;
case 4:"price=quantity*0.10";break;
default:cout<<"Invalid selection";
cout<<"The price is :"<<price;
return 0;
}

CHAPTER 5


TOPIC : IF ELSE ... SWICTH CASE......

EXAMPLE :


AGE   =    GENERATION

1-6      =  kids
7-12    =  child
13-21  =  teenagers 
22-30  =  adult
> 31    = old

if ..... else 


#include <iostream.h>

main ( )
{
declare variable
int age ;
// input
cout << " enter your AGE : " ;
cin >> age ;
//if else statement
if (age > = 1 II age <=6)
{cout << " you are kids ! " ;
else if ( age >=7 II age < = 12 )
{cout << '" you are child ! " ;
else if ( age >=13 II age <=21 )
{cout << " you are teenagers ! " ;
else if ( age <=22 II age <=30 )
{cout << " you are adult ! " ;
else if ( age > 30 )
{cout << " you are old ! " ;
else
{cout << "invalid selection" , ;
return 0 ;
}

swicth...case


#include < iostream.h>

main ( )
//declre variable
int age ;
//input
cout << " enter your age : " ;
cin >> age;
// swicth ... case statement
{ case ('age'>=1 II 'age' <= 6) : cout << " you are kids ! " ; break ;
case ( 'age'>=7 II 'age' <=12) : cout <<  " you are child ! " ; break ;
case ('age'>= 13 II 'age' <= 21) : cout << " you are teengers ! " ; break ;
case ( 'age' >= 22 II 'age' <=30) : cout << "you are adult ! " ; break ;
case ( 'age >30 ) : cout << " you are old ! " ; break ;
default : cout << " invalid selection " ;
}
return 0 ;
}

Friday, March 4, 2011

Chapter 4


1) Arithmetic operators :
    + + (Unary Plus)
    - - (Unary minus)
    + (Addition)
    - (Substraction)
    * (multiplication)
    / (Floating-point division / Integer division)
    % (Modulus)
Dlm C++, ade increament nan decrement operator..
    + + (Pre-increment) e.g + +m
    + + (Post-increment) e.g m+ +
    - - (Pre-decrement) e.g - -n
    - - (Post-decrement) e.g n- -

Tips utk sng hfl : klw simbol dy tuh kt dpn variable (Pre-), kne tambah or tolak nan 1.. tp klw simbol kt blkng (Post-) xyah tmbah pape.. ekot jek mcm soklan dy.. aq bg cth k..
SOALAN :        a = 2 , b = 3
                      m = 2 , n = 3
                       p = 2 , q = 3
                       x = 2 , y = 3            

(+ + a) + (- - b) * 4 > (+ + m) * (- - n) + 4

JAWAPAN :
               

2) Relational operators :
    < (Less than)
    > (Greater than)
    = = (Equal to)
    < = (Less than or equal to)
    > = (Greater than or equal to)
    ! = (Not equal to)

3) Logical operators : (0/False , 1/True)
    & & (AND) ----> ade je 0 mesti 0/false
    | | (OR) ----> ade je 1 mesti 1/true
    ! (NOT) ---->
    !(& &) (NOT AND) ---->
    !(| |) (NOT OR) ---->  | |
 e.g

Exercice 2..


Exercise 2 :
Bahasa melayu=
Bahasa inggeris=
Matematik=
Sains=
Total=
Average=

Formula :
total=bm+bi+math+sains
average=total/4


OK niy step na wt jawapan :
1) Go to my computer
     

2) Choose Local Disk (C:)

3) Click folder TC > folder BIN
    

4) Click TC application

5) If your windows can't support this system for full screen, just ignore MS-DOS Subsystem table
    (terime jela screen yg comel loteh kecik na mampos tuhh)

6) After open the Turbot C++ , click file > new > type your group coding

7) Answer for exercise 2

8) Don't forget to save the coding

9) To compile, go to compile menu and click compile

10) Press any key

11) If you make any mistake, syntax error will appear

12) To run, go to run menu and click run

 

#include<iostream.h>//header
main()//start body
{//open curly bracket
float bm;
float bi;
float math;
float sains;
float total;
float average;
//input 1
cout<<"bahasa melayu=";
cin>>bm;
//input 2
cout<<"bahasa inggeris=";
cin>>bi;
//input 3
cout<<"matematik=";
cin>>math;
//input 4
cout<<"sains=";
cin>>sains;
//formula
total=bm+bi+math+sains;
//output
cout<<"total="<<total;
//formula
average=total/4;
//output
cout<<"average="<<average;
return 0;
}//close curly bracket
//end body

Tuesday, February 15, 2011

l

Arini Ms Ayuni ada bagi exercise bgi setiap group 1 soklan...

Question
Multiply and divide two FLOAT numbers with using the formula below:
multiply=num1*num2
divide=num2/num1

Answer
FLOW CHART :

#include<iostream.h>// header
main()// start body
{// open curly bracket
//declare variable
float num 1;
float num 2;
float multiply;
float divide;
//input 1
cout<<"enter num 1";
cin>>num 1;
//input 2
cout<<"enter num 2";
cin>>num 2;
//formula
multiply=num1*num2;
//output
cout<<"multiply="<<multiply;
//formula
divide=num2/num1;
//output
cout<<"divide="<<divide;
return 0;
}//close curly bracket
//end body

Wednesday, February 9, 2011

Chapter 2


 On 1/2/2011, we learn for solving problem

Area of A Circle

ALGORITHM

1. Get the radius of a circle.

2. Calculate the area of circle with 3.14 multiply radius by radius.
3. Display the area of circle.

PSEUDOCODE


1. Read radius.

2. Set the area=3.14*radius*radius
3. Display the area of circle.


#include < iostream.h > // header

Main ( ) // Start body
{ // Open curly bracket
// Declare Variable
float area;
float radius;
// Input 1
COUT <<"Enter radius:">>;
CIN >> radius;
// formula
area=3.14*radius*radius
// output
COUT <<"Answer=" << area;
return 0;
} // close curly bracket
// End body 

P/s = jika berlainan soalan,kena tgok farmula

Wednesday, February 2, 2011

Chapter 1

Hi girl n guy...morning...pagi ni xde wt ape2 lagik..so ak tulis la ape y ak faham psal subject FOP y Ms Ayuni ajar...
Chapter 1
Programming and problem solving
1) Algorithm(arahan panjang)
2)Psuecode
3)Flowchart
4)Programing

Contoh 1
1 segiempat (kita nk dapatkan keluasan dalam segiempat tu)
formula { area : width x height}

a)Algorithm
1-get the width of rectange
2-get the height of rectange
3-calculate the area of rectange by multiply width by height
4-display the are rectange

b)Psuedocode
1-read width
2-read height
3-set a area = width * height
4-print output

c)Flow chart (kena buat dalam bentuk kotak2)
d)programinng



 byk lagik note i tapi ak xtaw cmne nk keyin lam blog ni...sape2 y expert tolong ajo ak ok...    
jasamu dikenang ok.....

My First Experience in FOP Class

Hi everybody! today i learn about FOP. FOP.....