Programming in C++

C++ is defined as the extension of C – language,also it is regarded as the middle-level language, as it compromise with combination of both high-level and low-level language features.Main advantage od C++ is, all the C++ compilers support the compilation of console programs.The structure of the C++ programs will be more or less same as the C Programs.Let’s see the hello world program using the C++ :

#include <iostream>
using namespace std;
int main ()
{
cout << “Hello World! “;     // it prints Hello World!
cout << “Welcome to Charmura.com”;  it prints Welcome to Charmura.com
return 0;
}

The Output will be Hello World!Welcome to Charmura.com.Also the following tables will give a list about the data types in C++:

Name

Description

Size*

Range*

char

Character or small integer.

1byte

signed: -128 to 127
unsigned: 0 to 255

short int (short)

Short Integer.

2bytes

signed: -32768 to 32767
unsigned: 0 to 65535

int

Integer.

4bytes

signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295

long int (long)

Long integer.

4bytes

signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295

bool

Boolean value. It can take one of two values: true or false.

1byte

true or false

float

Floating point number.

4bytes

+/- 3.4e +/- 38 (~7 digits)

double

Double precision floating point number.

8bytes

+/- 1.7e +/- 308 (~15 digits)

long double

Long double precision floating point number.

8bytes

+/- 1.7e +/- 308 (~15 digits)

wchar_t

Wide character.

2 or 4 bytes

1 wide character

The following explains about the scope of variables in C++:

msn4C++ continues to be used and is one of the preferred programming languages to develop professional applications. The language has gone from being mostly Western to attracting programmers from all over the world.It  is often decided as a superset of C, but this is not strictly true.And all the C code can easily be made to compile correctly in C++, but there are a few differences that cause some valid C code to be invalid in C++, or to behave differently in C++.

C++ have established its reliability in the development and maintainence sections of Information Technology.

Thanks

Name

Description

Size*

Range*

char

Character or small integer.

1byte

signed: -128 to 127
unsigned: 0 to 255

short int (short)

Short Integer.

2bytes

signed: -32768 to 32767
unsigned: 0 to 65535

int

Integer.

4bytes

signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295

long int (long)

Long integer.

4bytes

signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295

bool

Boolean value. It can take one of two values: true or false.

1byte

true or false

float

Floating point number.

4bytes

+/- 3.4e +/- 38 (~7 digits)

double

Double precision floating point number.

8bytes

+/- 1.7e +/- 308 (~15 digits)

long double

Long double precision floating point number.

8bytes

+/- 1.7e +/- 308 (~15 digits)

wchar_t

Wide character.

2 or 4 bytes

1 wide character

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>