Monday, 17 October 2011

Difference between call by value and call by reference

The parameters that appear in a function call statement are actual parameter and the parameter in function definition are called formal parameters.
In call by value method a copy of argument values r created and is then used in the function whereas in call by reference method the original variables are used in function call.
example:

1:)Swap numbers by call by value method:

void main()
{
void swap(int,int);
int a,b;
a=7;
b=4;
cout<<"the original values r";
cout<<"a="<<a<<"b="<<b;
swap(a,b);// invoke swap function 2 interchange a and b
cout<<"the values after swap() r";
cout<<"a="<<a<<"b="<<b;
getch();
}
void swap(int x,int y)
{
 int temp;
temp=x;
x=y;
y=temp;
cout<<"swapped values r";
cout<<"a="<<x<<"b="<<y;
}


output will b

a=7 b=4
swapped values r a=4 b=7
the values after swap() r a=7 b=4


2:)  Swap numbers by call by value method:

void main()
{
void swap(int &,int &);
int a,b;
a=7;
b=4;
cout<<"the original values r";
cout<<"a="<<a<<"b="<<b;
swap(a,b);// invoke swap function 2 interchange a and b
cout<<"the values after swap() r";
cout<<"a="<<a<<"b="<<b;
getch();
}
void swap(int &x,int &y)
{
 int temp;
temp=x;
x=y;
y=temp;
cout<<"swapped values r";
cout<<"a="<<x<<"b="<<y;
}


output will b

a=7 b=4
swapped values r a=4 b=7
the values after swap() r a=4 b=7 (i.e. a and b are modified)


Monday, 3 October 2011

Character set

The characters C++ can identify:
Letters: A-Z , a-z
Digits: 0-9
Special symbols: + , - ,  * , / , ^ ,  (  , ) ,  [  , ]  ,{  , } ,= , !=(not in c++ is represented by ! ), <  , > ,' ," $ , : . ; ,  % , @
White spaces Blank spaces , Horizontal tab ,Newline,Form feed.
Other Character : all 256 ASCII characters

Sunday, 2 October 2011

Starting with C++


First download the Turbo c setup file.You will get a zip folder .Extract those files and then run the set up file
if you hav a 32 bit O.S. then no need of DOS BOX but in case u hav 64 bit O.S.  download  DOS BOX and write the following commands in it:
mount c c:\
c:\
Cd TC\BIN
TC.EXE
You can also download Borland compiler

Monday, 26 September 2011

DNS

The character based naming system by which servers are identified is known as domain name system(DNS).
Some most common domain names: com, edu, gov, net, org and co .

Sunday, 25 September 2011

Web Browser And Web Server

The world wide web is based upon clients and server.
A www client is called Web Browser.
and a www server is called a Web server or just a server.

A web browser is a www client that navigates thru the World wide web and displays web pages .
A web server is WWW server that responds to the requests made by web browsers.