#include<iostream.h> //header
main( ) //start body
{ //open curly bracket
//declare variable
float area;
float radius;
//input 1
cout<<"Enter radius=";
cin>>radius;
//fomula
//fomula
area=3.14*radius*radius;
//output
//output
cout<<"area="<<area;
return 0;
}//close curly bracket
}//close curly bracket
//end Body
step2 nak wat nye :
1) firstly ngok formula yg tlah dibagi ;
1) firstly ngok formula yg tlah dibagi ;
*example area utk circle is area=3.14*radius*radius
2) second,cari bpe banyak variable name yg ade dlm cnth yg diberi.
3) then, declare variable
4) after that, wt flow chart bdasarkan soklan yg dy bg
*cth : start > read radius > area=3.14*radius*radius > print output > end
5) haa dh settle semua tdi,bru leh start wt coding.. ade beberape pkare yg sgt penting dlm coding niy.. antarenye :
*in the 1st line mest msukkn #include<iostream.h>
*in the 2nd line maskkn main()
*3rd line jgn lupe wt { tok strating & pntup wat body
*all in flow chart kne tulis dlm body
*huruf depands pade soalan sama ade huruf kecik smua @ besar
*xbole ade space except 4 the certain part mcm comment, declare variable and input&output yg ade dlm ("") & return 0
*dlm coding,jgn lupe letak simbol semi colun;
2) second,cari bpe banyak variable name yg ade dlm cnth yg diberi.
3) then, declare variable
4) after that, wt flow chart bdasarkan soklan yg dy bg
*cth : start > read radius > area=3.14*radius*radius > print output > end
5) haa dh settle semua tdi,bru leh start wt coding.. ade beberape pkare yg sgt penting dlm coding niy.. antarenye :
*in the 1st line mest msukkn #include<iostream.h>
*in the 2nd line maskkn main()
*3rd line jgn lupe wt { tok strating & pntup wat body
*all in flow chart kne tulis dlm body
*huruf depands pade soalan sama ade huruf kecik smua @ besar
*xbole ade space except 4 the certain part mcm comment, declare variable and input&output yg ade dlm ("") & return 0
*dlm coding,jgn lupe letak simbol semi colun;
Comment
- //*utk 1 baris coding
- /* , */ = utk ksuluruhan coding / >1 baris coding
- depands pde u all nk jarak2 @ rapat2
Declare variable ( Start )
*wjib hafal & kne tau k..
DATA TYPE | INTEGER |
---|---|
Integer | Integer (o-9) | >>>
Float | Float (decimals) | >>>
Double | Double (decimals) | >>>>>>>
Char | Character (a-z / A-Z) | >>>>>
String | String (Sentences) | >>>>>
Const | Constant (pi=3.142) | >>>
- Input
cin>>variable_name_thae_had_declare ;
WAJIB TAU :
- jgn salah ejaan,huruf besa @ kecik
- key in ikot soklan, jgn short form2
- * bahasa melayu= jgn wat bm plak. xbly suke2 wat short form k
- dlm ( " " ) tplang pde u all nk space @ x
cout<<"______"<<variable_name_that_had_declared ;
No comments:
Post a Comment