Tuesday, 1 February 2011

WEEKLY REFLACTION 2 MAI.

 -First,regisrer forum in web http://lect-ayuni.forumms.net
-Miss bg ms 45 minit utk msukkan ttg pergezaan antra
Procudural Programming,Structure Programming n Object Orientend Programming ke dlm forum di web http://lect-ayuni.forumms.net  n do by group.
-Bg emel blog n forum pd miss.
-Pengenalan bab2 ttg C++ Programming Language.
-Miss bg kerja by group tuk wt Programming n miss bg mark.






-Then,masukkn weekly reflecttion 1 ke dalam forum.
-Then,msukkn ttg Multiply Two Integers by group ni ke dlm forum.
-Tugasan takhir bt weekly reflection 2 by group in class n list in forum.
-faris n izwan tidak hadir pd hr ini..
:):):)see u..



C++ PROGRAM
(perkara wajib dalam c++)


#INCLUDE<iostream.h>-------->HEADER
---------------------------------------------------------
main()---->BODY
{//open curly bracket ---->START
}//close curly bracket---->END


__________________________________________________________________________________



  • IN BODY (dalam body)

1.variable:to declare variable
2.variable_name;  --->SEMIKOLEM



  • INPUT
cout<<"ENTER your radius=";
cin>>radius;



  • OUTPUT
COUT<"area='<<area'
__________________________________________________________________________________


(rangka buat)






#include<iostream.h>
main()
{
//declare variable
float pi,radius;
//input radius
cout<<"Enter radius=";
cin>>radius;
//formula
pi=3.145*r*r;
//output
cout<<"area="<<pi;
return o;
}








DATA TYPE.


INTEGER int =no 0-9
FLOAT=decimal
DOUBLE=decimal
CONSTANT const=formula akan jadi statik dan kekal
CHARACTER char=1 perkataan
STRING=perkataan panjang.





EXERCISER BY GROUP IN CHAPTER2.

 PROGRAMING EXERCISE 1 FOP.

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;
}


CONTOH LATIHAN DALAM KELAS

1) Sum and Minus Two Integers


#include<iostream.h>
main( )
{
//declare variable
float sum,minus,num1,num2;
//input1
cout<<''num1='';
cin>>num1;
//input2
cout<<''num2='';
cin>>num2;
//formula
sum=num1+num2;
minus=num2-num1;
//output
cout<<''sum=''<<sum;
cout<<''minus=''<<minus;
return 0;
}

2)Divide and Modulus Two Integers


#include<iostream.h>
main( )
{
//declare variable
float divide, modulus, Num1, Num2;
//Input 1 
cout<<"Num1= ";
cin>>Num1;
//Input 2
cout<<"Num2= ";
cin>>Num2 ;
//formula
Divide=Num2/Num1;
Modulus=Num1%Num2;
//Output
cout<<"divide="<<divide;
cout<<"modulus="<<modulus;
return 0;
}


3)Fahrenheit Convert to Celcius


#include<iostream.h>
main( )
{

float celcius;
float farenheit;

cout<<"Enter farenheit=";
cin>>farenheit;

celcius=5/9*(farenheit -32);

cout<<"farenheit= "<<farenheit;
cout<<"celcius= "<<celcius;

return 0;
}

4)Celcius Convert to Fahrenheit


#include<iostream.h>
main()
{
float celcius,farenheit;
cout<< "Enter celcius=";
cin>>celcius;
farenheit=9/5*(celcius+32);
cout<<"Celcius="<<celcius;
cout<<"Farenheit="<<farenheit;
return 0;
}

No comments:

Post a Comment