Você está na página 1de 4

c 

c      

   
x++ Postincrement
++x Preincrement
x-- Postdecrement
--x Predecrement
+x Unary plus
-x Unary minus
x*y Multiply
x/y Divide
x%y Modulus
x+y Add
x-y Subtract
pow(x,y) or TMath::Power(x,y) Exponation
x=y Assignment
x += y (-=,*=,/=,%=,...) Updating assignment


  
  

We use it, when the method need not to return a value.


A void return type indicates that a method does not return a value
??

   

A Loop statement is one which execute a certain set of statement repeatedly until certain
condition satisfied.

 
int i=0;
do{
cout << "hai";
i=i++;
}while(i<5)

O/P:: hai
hai
hai
hai
hai


!
 "  " 
Swapping means the value of two or more variable is interchanging.

 #

int i=india;

int j=china;

int temp = i;

i = j;

j = temp;

cout << i;

 china

$  

A class is a programming language construct that is used to group related instant variables
and methods.

%  "&

In OOP , an object is an instantiation (implementation) of a class.

' 
((  "  "&
 

A  is constant one. All of the attributes of a class are fixed before, during, and after the
execution of a program. The attributes of a class don't change

Objects are created during execution and eventually destroyed. Also during that lifetime, the
attributes of the object may undergo significant change.

) *(( " "
 

  
Declaring a variable or member function private means that the variable & the function can
be accessed only within the class or subclass.
" 
Declaring a variable or member function public means that the variable & the function can be
accessed from any where in the code.

  
Declaring a variable or member function private means that the variable & the function can
be accessed only within the class or subclass.

+,   ( 


The 4 principles of OOPS are c"   , Ineheritance, Polymorhpism and Encapsulation.
Method Overloading and Overriding are a part of the Polymorphism

++ "   

Abstraction refers to the act of representing essential features without including the
background details.

+void main()
{
int const * p=5;
printf("%d",++(*p));
}
c 
Compiler error: Cannot modify a constant value.
#  
p is a pointer to a "constant integer". But we tried to change the value of the "constant
integer".

+main()
{
char s[ ]="hai";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
c 
hhhh
aaaa
iiii
# 
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array
name is the base address for that array. Here s is the base address. i is the index
number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may
be surprising. But in the case of C it is same as s[i].

+!main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
c 
00131
#  
Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator
has higher priority over the logical OR (||) operator. So the expression µi++ && j++ && k++¶
is executed first. The result of this expression is 0 (-1 && -1 && 0 = 0). Now the expression
is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for µ0 || 0¶
combination- for which it gives 0). So the value of m is 1. The values of other variables are
also incremented by 1.

+-*((  " (   
 .   
 
   
 C++ enables several functions of the same name to be defined, as
long as these functions have different sets of parameters (at least as far as their types are
concerned). This capability is called function overloading. When an overloaded function is
called, the C++ compiler selects the proper function by examining the number, types and
order of the arguments in the call. Function overloading is commonly used to create several
functions of the same name that perform similar tasks but on different data types.

   


 allows existing C++ operators to be redefined so that they work on
objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent
function calls. They form a pleasant facade that doesn't add anything fundamental to the
language (but they can improve understandability and reduce maintenance costs).

+$*((  " /01
 01

Realloc() is used to reallocate the memory for variable

Free() is used to free the allocated memory of a variable


?

Você também pode gostar