Wednesday, March 23, 2011

CHAPTER 2

#include<iostream.h> // header
main ( ) // start body
{ // open curly bracket
} // close curly bracket
// coment hidden
// 1 row coding
/ *,* / lebih dari 1 coding

declare variable
data_type / variable_name

data_type

int > integer
float > float (decimal)
double > double (decimal)
char > character (a-z / A-Z)
string > string (sentences)
const > constant (x berubah)

Rules:
1.look formula
2.find how many variable name
3.declare variable

Input:
cout<<"................";
variable_name_that_had_declared;

sample question

flow chart:

start>read radius>area=3.14 * radius * radius > print output

#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 bracket

No comments:

Post a Comment