11th Computer Science All The Syntaxes
11th Computer Science All The Syntaxes
n
setprecision float sum=1200.123;
l.i
cout<<setprecision(5)<<sum;
Explicit Type Conversion typename expression;
da
if(expression/condition)
If Statement True block;
ka
Statement – x;
if(expression/condition)
vi
{
True block;
al
}
If – Else Statement
else
{.k
w
False block;
}
w
if (expression – 1)
{
w
if (expression – 2)
{
Nested If Statement – If nested inside if part True_Part_Statements;
}
else
{
False_Part_Statements;
}
CREATED BY P. SUBRAMANIAN M.Sc(I.T)., B.Ed., 9677066334 Page 1
CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM – 612 001
}
else
{
body of else part;
}
if (expression-1)
{
body of true part;
}
else
{
n
if (expression)
Nested If Statement – If nested inside else part {
l.i
True_Part_Statements;
da
}
else
{
ka
False_Part_Statements;
}
vi
}
if (expression)
al
{
.k if (expression)
{
w
True_Part_Statements;
}
w
else
w
n
break;
case constant2:
l.i
statement – 2;
da
break;
Switch Statement case constant3:
statement – 3;
ka
break;
case constant4:
vi
statement – 4;
break;
al
default:
.k
statement – x;
}
w
for (initializations; test expression ; update expression)
{
w
For Loop
body of the Loop;
w
}
while (Test Expression)
{
While Loop body of the Loop;
}
Statement – X;
do
Do – While Loop
{
n
l.i
Break Statement
da
ka
vi
al
Continue Statement
.k
w
w
w
n
islower() int n = islower(‘A’); //the value of n is zero.
int r = islower(‘a’); //the value of r is non – zero value.
l.i
isupper(char c);
da
isupper() int n = isupper(‘a’); //the value of n is zero.
int r = isupper(‘A’); //the value of r is non – zero value.
ka
toupper(char c);
toupper()
char c = toupper('a’); //the character A is assigned to c
tolower(char c);
vi
tolower()
char c = tolower('B’); //the character b is assigned to c
al
strcpy() strcpy(targetstring,sourcestring);
strcmp() strcmp(string1,string2);
strcat()
strupr()
.k
strcat(targetstring,sourcestring);
strupr(str);
w
strlwr() strlwr(str);
w
cos() cos(x);
sin() sin(x);
w
sqrt() sqrt(x);
pow() pow(base,exponent);
Constant Arguments return_type function_name (const data_type variable=value)
Inline Function inline returntype functionname(datatype parameter1, … datatype parameter-n)
Return Statement return expression/variable;
Declaration of One – Dimensional Array data_type array_name [array_size];
Initialization of One – Dimensional Array data_type array_name [size] = {value-1,value-2,…………… ,value-n};
Declaration of One – Dimensional char Array char array_name[size];
CREATED BY P. SUBRAMANIAN M.Sc(I.T)., B.Ed., 9677066334 Page 5
CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM – 612 001
Initialization of One – Dimensional char Array char array_name[size]={list of characters separated by comma or a string};
Declaration of Two – Dimensional Array data_type array_name[row-size][col-size];
struct structure_name
{
Declaration of Structure type member_name1;
type member_name2;
} reference_name;
class class-name
{
private:
data member declaration;
n
member function declaration;
l.i
protected:
Declaration of Class
data member declaration;
da
member function declaration;
public:
data member declaration;
ka
member function declaration;
};
vi
return_type class_name :: function_name (parameter list)
al
{
Outline Member Function
function definition
}
class derived_class_name : visibility_mode base_class_name
{
Defining the Derived Class
// members of derivedclass
};