Friday, March 4, 2011

PROGRAMING EXERCISE 1(weekly reflection 2)


C++ PROGRAM




PERKARA-PERKARA YANG PERLU ADA DI DALAM C++ ADALAH SEPERTI YANG DITUNJUKKAN DIBAWAH INI


#INCLUDE<IOSTREAM.H>-------->HEADER
---------------------------------------------------------
MAIN()---->BODY
{//OPEN CURLY BRACKET ---->START
}//CLOSE CURLY BRACKET---->END
__________________________________________

IN BODY
1 .VARIABLE:TO DECLARE VARIABLE
2. VARIABLE_NAME;  --->SEMIKOLEM

INPUT
COUT<<"ENTER YOUR RADIUS=";
CIN>>RADIUS;

OUTPUT
COUT<"AREA='<<AREA'
__________________________________________



 INI ADALAH 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.




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


No comments:

Post a Comment