Daisypath Anniversary tickers

Daisypath Anniversary tickers

Friday, April 8, 2011

CORRECTION MIDTERM.........

SECTION A:

#include
main()
{
float price=0,total;
int i;
for ( i =1;i<=3;i++)
{
cout<<"Enter price ["< cin>>price;
total + = price;
}
cout<<"Total="<return 0;
}








SECTION B

QUESTION 1:

Variables

A variable is the storage location in memory that is stored by its value. A variable is identified or denoted by a variable name. The variable name is a sequence of one or more letters, digits or underscore.
For example: character _

Rules for defining variable name:

Variable's name MUST be unique.
Cannot be more than 31 characters.
MUST begin with letters.
NO space in between.
Can't begin with numbers, symbols, or special characters.

DATA TYPES

CHARACTER
· Consist of all LETTERS, NUMBERS, and SPECIAL SYMBOLS.
· Surrounded by SINGLE QUOTATION MARK (' ' ).
· Example: 'A', 'm', '#', '1', or ' '.

STRING
· Combination of more than one character.
· Surrounded by DOUBLE QUOTATION MARK (" " ).
· Example: (" WELCOME TO MY PAGE") OR ("8876").

LOGICAL VALUES/BOOLEAN
· Making Yes-or-No decisions ( TRUE-or-FALSE).
· Example: to check two integers using if… … else control structure.
Assume a=2 and b=5
If (a
Decision is TRUE
Else
Decision is FALSE

INTEGER
· Whole POSITIVE and NEGATIVE numbers including ZERO and NO DECIMAL place.
· Example: 0, +1, -10.
· Used to represent the counting of things.
· Example: Numbers of month in a year (1,2,3 …).

FLOATING POINTS (FLOAT)
· Contain all numbers with DECIMAL points.
· Stored in floating point
· Used for metric measurement, temperature and price.
· Example: 1.0cm, 234.55kg, RM20.30, 36.7C.

DOUBLE
· Floating point data types comes in three sizes, namely float, double and long double.
· The difference is in the length of value and amount of precision which they can take and it increases from float to long double.
· double: This data type is used to represent double precision floating point number.

LONG DOUBLE
· This data type is used to represent double precision floating point number.

CONSTANT
· fixed values which cannot change.
· example 123, 12.23, 'a' are constants.

ARRAY
· A set of locations in the computer memory that has the same name and contains the same data type.
· It is almost the same as variable, but variable has allocated only one location that can store one value at a time. Where else, array can allocate more than one location to store several values at a time.

LONG/SHORT INTEGER
· LONG INTEGER: This data type is used to represent long integer.
· SHORT INTEGER: This data type is used to represent short integer.
the next example is:


QUESTION 2:

Change from if.. else statement to Switch .... case statement

if... else statement






Swith... case statement









QUESTION 3:

a)Change from Loop for to Loop while

Loop for

#include
main ()
{
int x, y = 2;
for (x = 1; x ,=5: x++)
{cout << "" << x * y ; }
return 0;
}

Loop while

//include
main()
{
int x,y=2;
while
x=1;
while(x<=5);
{
cout<<" "<x++
return 0
}
}

ASSIGNMENT SIFIR...

STEP 1)



STEP 2)



STEP 3)



STEP 4)



STEP 5)










STEP 6)










STEP 7)

ASSIGNMENT TIN MINUMAN......

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)











STEP 5)

(KALAU MASOKKAN DUIT LEBIH)











STEP 6)











STEP 7)











STEP 8)

(KALAU MASOKKAN DUIT TAK CUKOP)











STEP 9)











STEP 10)










STEP 11)

Thursday, April 7, 2011

More exercise....

1) Complete the code that can calculate total marks for 3 students
for(int stud=1;____(a)____;stud++)
{
cout<<"Enter Student name:";
____(b)____name;
for(int mark=1;mark<=3;____(c)____)
{
cout<<"Enter assigment marks:";
cin>>marks;
total=____(d)____+marks;
}
}
cout<<"Total marks are"<<____(e)____;

answer

(a) stud<=3
(b) cin>>
(c) mark++
(d) total
(e) total

2) Based on the short code below :
Change for loop statement below to while loop
for(x=1;x<=5;x++)
cout<
answer

x=1;
while(x<=5)
cout<x++

3) Write the code using while loop to get the output as below !
20
15
10
5

answer

x=20
while(x<=5)
cout<<" "<x--;

EXERCISE!!

Soklan 1)

Change the if...else statement below to switch...case statement

#include
main()
{
int nomA,nomB,selection,value;
cout<<"Enter 2 number:";
cin>>nomA>>nomB;
cout<<"1.Addition";
cout<<"2.Substraction";
cout<<"3.Multiply";
cout<<"4.Division";
cout<<"Enter selection=";
cin>>selection;
if(selection==1)
{value=nomA+nomB;}
else if(selection==2)
{value=nomA-nomB;}
else if(selection==3)
{value=nomA*nomB;}
else if(selection==4)
{value=nomA/nomB;}
else
{cout<<"Invalid selection";}
cout<<"The value is:"<return 0;
}

Jawapan 1)

#include
main()
{
int nomA,nomB,selection,value;
cout<<"Enter 2 number:";
cin>>nomA>>nomB;
cout<<"1.Addition";
cout<<"2.Substraction";
cout<<"3.Multiply";
cout<<"4.Division";
cout<<"Enter selection=";
cin>>selection;
switch(selection)
{
case1:"value=nomA+nomB";break;
case2:"value=nomA-nomB";break;
case3:"value=nomA*nomB";break;
case4:"value=nomA/nomB";break;
default:cout<<"Invalid selection";
cout<<"The value is:"<}
return 0;
}

Soklan 2)

Change the for loop statement below to while loop

#include
main()
{
int i,power2;
for(i=1;i<=9;i++)
{
power2=i*i;
cout<<" "<}
return 0;
}

Jawapan 2)

#include
main()
{
int i,power2;
//while
i=1;
while(i<=9)
{
power2=i*i;
cout<<" "<i++;
}
return 0;
}

Soklan 3)

Write a program that input 2 numbers. Compare the numbers & display only the biggest number. If the numbers are same, display the numbers are same.

Jawapan 3)

#include
main()
{
int nomA,nomB;
cout<<"Enter 2 numbers=";
cin>>nomA>>nomB;
if(nomA>nomB)
{cout<<"nom A is bigger than nom B";}
else if(nomA==nomB)
{cout<<"nom A is same as nom B";}
else
{cout<<"Invalid";}
return 0;
}

Soklan 4)

Write a program using for loop that receive prices of 3 products. Calculate the price that must be paid after 10% discount is given to every customer.

Jawapan 4)

#include
main()
{
int x,price,total,discount;
for(x=1;x<4;x++)
{
cout<<"price["<cin>>price;
total=total+price;
}
cout<<"total="<discount=total*0.10;
cout<<"discount"<return 0;
}

Soklan 5)

What is the output for the following program segment

5.i) int x=20;
for(int i=5;i<=x;i++)
{
cout< i=i+4;
}

Jawapan 5.i)

5
10
15
20

5.ii) int mul=1;
do
{
mul=mul*2;
cout<<"The mul is:"< mul++;
}
while(mul<10)

Jawapan 5.ii)

1
3
7

Monday, March 28, 2011

Alaaaaaaaaaaaaaaaaa................

ala.... Turbo C++ nih mane leh wat.. cemane nk wat ass yg gune C++....
HELP!!!! HELP!!!!! kalo x payah gune C++ bule ke???

Saturday, March 26, 2011

FOR LOOP & WHILE LOOP..... HULAHOOOOPPP.....

FOR LOOP...

#include
main()
{
//declare variable
int x,y;
cout<<"Enter an integer=";
cin>>x;
//loop for
for(y=1;y< x;y++)
{
cout<<" "<}
return 0;
}

WHILE LOOP...

#include
main()
{
//declare variable
int x,y;
cout<<"Enter an integer=";
cin>>x;
//while
y=x;
while(y{
cout<<" "<y++;
}
return 0;
}

new chapter

Soklan 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>>number;

Soklan 2

Change the if...else statement below to switch...case statement

#include
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 :"<return 0;
}

Jawapannye....

#include
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 :"<return 0;
}

IF.... ELSE.......SWITCH......CASE....STATEMENT.....XD

IF.....ELSE STATEMENT
#include
main()
{
//declare variable
int age;
//input
cout<<"Enter your age=";
cin>>age;
//if...else statement
if(age>=1||age<=6)
{cout<<"you are kids !!";}
else if(age>=7||age<=12)
{cout<<"you are child !!";}
else if(age>=13||age<=21)
{cout<<"you are teenager !!";}
else if(age>=22||age<=30)
{cout<<"you are adult !!";}
else if(age>30)
{cout<<"you are old !!";}
else
{cout<<"Invalid selection";}
return 0;
}


SWITCH.....CASE STATEMENT
#include
main()
{
//declare variable
int age;
//input
cout<<"Enter your age=";
cin>>age;
//switch...case statement
switch(age)
{
case(age>=1||age<=6):cout<<"you are kids !!";break;
case(age>=7||age<=12):cout<<"you are kids !!";break;
case(age>=13||age<=21):cout<<"you are kids !!";break;
case(age>=22||age<=30):cout<<"you are kids !!";break;
case(age>30):cout<<"you are kids !!";break;
default:cout<<"Invalid selection";
}
return 0;
}

EXERCISE

1) Solve the question below:

a) 5*2%3+25/5
=(5 * 2) % 3 + (25 / 5)
=(10 % 3) + 5
= 1 + 5
= 6

b) a=5, b=6
! ((a<3) && (a==3) || (b>9))
= ! ((5 < 3) && (5 = = 3) || (6 > 9))
= ! ((0) && (0) || (0))
= ! ((0) || (0))
= ! (0)
= 1 / True

2) Identify the syntax errors in the following program:

include
mai()
{
float allowance=300.00 salary;
//input
cout<<"input salary=";
cin>salary;
salary=salary+allowance;
//output
cout<<"salary is="<}

answer:

#include
main()
{
float allowance=300.00 salary;
//input
cout<<"input salary=";
cin>>salary;
salary=salary+allowance;
//output
cout<<"salary is="<return 0;
}

3) Write a program that calculate the monthly salary for an employes that where saturday & sunday are considered as non working days.

#include
main()
//declare variable
float no working days;
float salary per days;
float monthly salary;
//input 1
cout<<"no working days";
cin>>no working days;
//input 2
cout<<"salary per days";
cin>>salary per days;
//formula
monthly salary=working days*salary per days;
//output
cout<<"monthly salary="<return 0;
}

4) Write a program that calculate the average of 5 numbers that can be input by user.

#include
main()
float num1;
float num2;
float num3;
float num4;
float num5;
float total;
float average;
//input 1
cout<<"num1";
cin>>num1;
//input 2
cout<<"num2";
cin>>num2;
//input 3
cout<<"num3";
cin>>num3;
//input 4
cout>>"num4";
cin>>num4;
//input 5
cout<<"num5";
cin>>num5;
//formula 1
total=num1+num2+num3+num4+num5;
//output 1
cout<<"total="<//output 2
cout<<"average="<return 0;
}

5) Write a program that will calculate the area of rectangular, triangle and circle.

#include
main()
{
//declare variable
float height;
float width;
float area of rectangle;
float radius;
float area of circle;
float height;
float area of triangle;
//input 1
cout<<"height";
cin>>height;
//input 2
cout<<"width";
cin>>width;
//input 3
cout<<"radius";
cin>>radius;
//input 4
cout<<"height";
cin>>height;
//formula 1
area of rectangle=height*width;
//output 1
cout<<"area of rectangle="<//formula 2
area of circle=3.14*radius*radius;
//output 2
cout<<"area of circle="<//formula 3
area of triangle=0.5*height*height;
//output 3
cout<<"area of triangle="<return 0;
}

latihan

wat latihan lagik....

soklan...

















jawapan...







erm.. x clear sangat le... huhu.. tp still leh bacekan.. hehe..

aa.. peberet chapter.....

Aaaaa... yang nih chap yg paling aku suke... kire chap peberet le.. best sebab senang nk paham.. gagaggaa.. huhu... maklom la.. chap len mcm nk pecah pale.. chap nih sronok sket.. men kire2.. cam math...

Arithmetic operators :
+ + (Unary Plus)
- - (Unary minus)
+ (Addition)
- (Substraction)
* (multiplication)
/ (Floating-point division / Integer division)
% (Modulus)

increament & decrement operator..
+ + (Pre-increment) e.g + +m
+ + (Post-increment) e.g m+ +
- - (Pre-decrement) e.g - -n
- - (Post-decrement) e.g n- -

soklannye...

a = 2 , b = 3
m = 2 , n = 3
p = 2 , q = 3
x = 2 , y = 3


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

jawapannye pulak...

(+ + a) + (- - b) * 4 > (+ + m) * (- - n) + 4
(2 + 1) + (3 - 1) * 4 > (2) * (3) + 4
(3) + (2) * 4 > 2 * 3 + 4
3 + 8 > 6 + 4
11 > 10
1 / TRUE


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


Logical operators :

& & (and)








l l (or)







! (not)






! (& &) (not and)
! (l l ) ( not or)


Soklan for group...

Soklan nih miss bagi tp kene wat ikot group.. soklan nih da upload kt forum.. tp lupe lak nk upload kt blog... huhu.... err... mase nih group kitorg dpt second last.. okeh le tuh...


Bahasa melayu=
Bahasa inggeris=
Matematik=
Sains=
Total=
Average=


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

jawapan seperti berikot...


#include//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="<//formula
average=total/4;
//output
cout<<"average="<return 0;
}//close curly bracket
//end body


miss soh wat dlm C++.. oleh kerane akunye comp nih bengap sangat.. aku x leh nk wat C++.. so aku just typing je la... da pening sangat da nk wat C++ nih camne.. kalo nk tunggu alamat x siap la keje aku.. hukhukhuk...

SOKLAN MENGUJI

Mase soklan nih.. ehem.. aku mcm bese la... lambat masok class.. tp still ramai yg lom masok class.. bebudak len da stat wat soklan.. then aku pon menyelit le kt sbelah yani.. hukhukhuk.... err.. ni jawapan tok soklan uh....

Soklannye...

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

jawapannye pulak...

Flow chat





















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

FINDING

Find Fahrenheit [formula : fahrenheit = (9/5)*(celcius+32)]
ALGORITHM

Get the celcius of fahrenheit
Calculate fahrenheit equal to nine divided by five multiply by celcius plus 32
Display the fahrenheit of celcius
PSEUDOCODE

Read the celcius
Set the fahrenheit = (9/5)*(celcius+32)
Print output




















Find Celcius [formula : celcius = (5/9)*(fahrenheit-32)]
ALGORITHM

Get the fahrenheit of celcius
Calculate celcius equal to five divided by nine multiply by fahrenheit minus 32
Display the celcius of fahrenheit
PSEUDOCODE

Read the fahrenheit
Set the celcius = (5/9)*(fahrenheit-32)
Print output




















Find Area Of Circle [formula : area=3.14*radius*radius]
ALGORITHM

Get the radius of circle
Calculate the area of circle with 3.14 multiply by radius by radius
Display the area of circle
PSEUDOCODE

Read the radius
Set the area = 3.14*radius*radius
Print output

Thursday, March 10, 2011

APE PASAL HA?!!!!!

Ape pasal ek? Pelik...
apsal nk install turbo C++ nih x bley...
saket ati tol... kt laptop x bley, kt PC x bley... abeh tu camne nk wat..
aku nih banyak sangat kot dosenye......... dari ari tu ade je masalah kalo nk wat keje..
Huuu... kene muhasabah diri nih...
Tiap kali nk wat keje je tenet x leh gune la.. xde karen la.. x masok lagik masalah2 yg len2...
Dulu sebok keje.. ni da brenti keje pon still x bley wat jugak.. Nk masak la.. Basoh baju la.. Husband balik uma tau da siap masak.. uma da bersih... hmm... bukan merungut.. tp rasenye aku pon still x pandai nk susun timing kot.. tu la antare sebab musababnye aku rase la...
Kadang2 tension.. tp still ingat tuhan... hehe...
Dulu nk g class problem keje... x sempat.. x de bas.. jalan jem.. skang da x keje.. ujan pulak tiap2 petang.. huh.. petang nih aku ade class nih.. tp xtau dpt g ke x.. sbb ujan nih.. siap ade petir dan guruh... kesiankan aku..
Pade kawan2 yg bace post nih... atau pade sesape yang berkenaan la.. kalau aku ade wat salah kt korang.. ade wat dose yg aku prasan atau x prasan.. (kadang2 gurau2 terkasar then x prasan korg touching....) aku mintak maaf la ye.. mungkin sbb banyak dose kt korang, aku nih slalu dilande masalah... aku berdoa semoga segala urusan aku berjalan dengan lancar... amin........

Monday, March 7, 2011

Lagik.. Chapter Two pulak...... (*_*)

Kat Chap 2 nih kitorg blajo pasal C++.. Erm amendealah uh.. Progamming language ke? uuuu... tu la.. mase class asik nk skip je.. padahnye sape nk nangung.. naseb ade membe yg prihatin kasik notes... Luv U gurlz.. Cayang korang.. hehe.. kat bawah nih contoh C++ yg mis aja... kalo nk wat mendealah nih mestilah berdasarkan flowchart yg kite wat uh..

#include //header
main( ) //start body
{ //open curly bracket
//declare variable
float area;
float radius;
//input 1
cout<<"Enter radius=";
cin>>radius;
//fomula
area=3.14*radius*radius;
//output
cout<<"area="< return 0;
}//close curly bracket
//end body

Nk wat coding nih kene ikot rules macam kt bawah nih:
1) Mule2 kene ikot formula macam yg die bagi, area utk circle area= 3.14*radius*radius
2) Carik brape variable name yg ade pastu declarekan
3) Pastu wat flowchart ikot soklan
cth:start>read radius>area=3.14*radius*radius>print output >end
4) Pastu wat la coding macam kt atas uh..



START..............( Tu We Ige..) GO!!!!

Firstly kite start nan Chapter One la ek... Hmm..
Kat Chap 1 nih kitorg blajo tang Algorithm, Pseudocode, nan Flowchart...

Algorithm = sequence of instructions to solve a problem.

Pseudocode= outline of a program, written in a form that can easily bo converted into programming statement.

Flowchart = graphic representation of the logic or steps in a program.

e.g: Find Area Of Rectangle

Algorithm
Get the width of rectangle
Get the height of rectangle
Calculate the area of rectangle by multiply width by height
Display the area of rectangle

Pseudocode
Read the width
Read the height
Set the area = width*height
Print output


Flowchart




















FUHHHH!!!!!!!!!!

Gile macam tuuutttt...... Gatal sangat tangan g tuko2 layout blog nih.. da sudah abes ilang sume tulisan.. uuu... padahnye sume keje tergendale.. satu keje x jadik. frust gile.. geram gak rasenye.. tp sala sendrikkan.. tp ari ni berjaye di selamatkan jugak setelah berusehe mengodeh- godeh sume2 yg ade.. hoho.. poyo sungguh.. tu la. bute IT kan.. KESIAN......

ehem......

testing testing....

Wednesday, February 16, 2011

oi oi oi..

ala... baru bukak blog nih je pale otak da nek blur...
huhu.. td banyak sangat idea nk wat.. urm.. nk wat ape yg mis suroh wat tp x tau lagik..
sori miss.. sy still x paham2 pemende yg nk di buat.. uuu.. bz jek kan.. keje.. x abes2.. tuh jek alasannyek.. hehehe.... tp sies... mmg bz.. cam mase tok diri sendrik pon tade..

Tape.. ari nih kite introduce diri sendirik je... Name saye Nor Sahbirinah binti Jamaludin.. owang yang slalu datang class lambat.. aaa.. haku le tuh...
umm.. nick purlz.. mrepek kan.. hehe... tp suke je nick tuh... ti miss kawan2 jangan konpius lak.. nengok sape tah purlz tuh.. hehe...

Lagik ape nk cite.... aa.. last week baru start masok class.. owg len da betaon da blajo da nk sampai Z... aku masih nk start dr A... ape a... tu yg lampi jek.. (lambat pickup).. abeh tu.. bz.... keje..... huhu... alasan normal.. tp insyaallah.. aku akan kuatkan semangat nk kejar dorg2 uh sume.. aku berazam tanak kecewekan diri aku sendrik.. suami.. pn. ayuni yg x bosan2 mengajar aku... thanks miss..

uu.. sampai sini je la dulu.. t ade mase aku bebel lagik..
Chaw!!!!

Friday, February 11, 2011

uuuuu.......

wat blog baru........
ape la baru nk start wat.. hegeh2 cam sipot.. owg len da banyak title da..
hehe.. xpe.. lambat sikit je kan....