0% found this document useful (0 votes)
337 views6 pages

11th Computer Science All The Syntaxes

Uploaded by

thayaguna26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
337 views6 pages

11th Computer Science All The Syntaxes

Uploaded by

thayaguna26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

CHRIST THE KING BOYS MATRIC HR. SEC.

SCHOOL, KUMBAKONAM – 612 001


LIST OF SYNTAXES
NAME SYNTAXES
datatype var1,var2,….var-n;
Variable Declaration
int a,b;
datatype &reference variable =original variable;
Reference Variable int a=10;
int &b=a;
setw(number of characters)
setw int a=2,b=3;
cout<<setw(4)<<a<<setw(10)<<b;
setprecision(number of digits)

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

If Nested inside both if and else part {


False_Part_Statements;
}
}
else
{
if (expression)
{

CREATED BY P. SUBRAMANIAN M.Sc(I.T)., B.Ed., 9677066334 Page 2


CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM – 612 001
True_Part_Statements;
}
else
{
False_Part_Statements;
}
}
switch (expression)
{
case constant1:
statement – 1;

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
{

CREATED BY P. SUBRAMANIAN M.Sc(I.T)., B.Ed., 9677066334 Page 3


CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM – 612 001
body of the Loop;
}
while (Test Expression);
goto label;
--------------
Goto Statement
--------------
label:

n
l.i
Break Statement

da
ka
vi
al
Continue Statement
.k
w
w
w

for (initialization(s); test-expression; update expression(s))


{
for (initialization(s); test-expression; update expression(s)
Nested Loop {
statement(s);
}
statement(s);
CREATED BY P. SUBRAMANIAN M.Sc(I.T)., B.Ed., 9677066334 Page 4
CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM – 612 001
}
isalnum (char c)
isalnum() int p = isalnum(‘5’); //the value of p is non – zero value.
int r = isalnum(‘$’); //the value of r is zero.
isalpha(char c);
isalpha() int n = isalpha(‘4’); //the value of n is zero.
int m = isalpha(‘a’); // the value of m is non – zero value.
isdigit(char c);
isdigit() int n = isdigit(‘4’); //the value of n is non – zero value.
int m = isdigit(‘a’); // the value of m is zero.
islower(char c);

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

Accessing Class Members


}
.k
Object_name . function_name(actual parameter);
w
returntype classname :: operator operator Symbol (argument list)
{
w
Operator Overloading Function
//Function body
w

}
class derived_class_name : visibility_mode base_class_name
{
Defining the Derived Class
// members of derivedclass
};

CREATED BY P. SUBRAMANIAN M.Sc(I.T)., B.Ed., 9677066334 Page 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy