C++ Programming Code Examples
C++ > Beginners Lab Assignments Code Examples
C++ Built-in Data Types
C++ Built-in Data Types
Any programming language has built in data types. The data types are used to create variables or your new data types. A variable is a amount of memory that has its own name and value. That's why it is important to know the built in data types, their properties, diapason and size. The official Microsoft site is offering the following information about C++ built in data types:
Type Name Bytes Range of Values
Int 4 2,147,483,648 to 2,147,483,647
unsigned int 4 0 to 4,294,967,295
bool 1 false or true
char 1 128 to 127
signed char 1 128 to 127
unsigned char 1 0 to 255
short 2 32,768 to 32,767
unsigned short 2 0 to 65,535
Long 4 2,147,483,648 to 2,147,483,647
unsigned long 4 0 to 4,294,967,295
long long 8 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long 8 0 to 18,446,744,073,709,551,615
float 4 3.4E +/- 38 (7 digits)
double 8 1.7E +/- 308 (15 digits)
long double same as double Same as double
wchar_t 2 0 to 65,535
The cout is a predefined object of ostream class. It is connected with the standard output device, which is usually a display screen. The cout is used in conjunction with stream insertion operator (<<) to display the output on a console. On most program environments, the standard output by default is the screen, and the C++ stream object defined to access it is cout. The "c" in cout refers to "character" and "out" means "output". Hence cout means "character output". The cout object is used along with the insertion operator << in order to display a stream of characters.
The cin object is used to accept input from the standard input device i.e. keyboard. It is defined in the iostream header file. C++ cin statement is the instance of the class istream and is used to read input from the standard input device which is usually a keyboard. The extraction operator(>>) is used along with the object cin for reading inputs. The extraction operator extracts the data from the object cin which is entered using the keyboard. The "c" in cin refers to "character" and "in" means "input". Hence cin means "character input". The cin object is used along with the extraction operator >> in order to receive a stream of characters.
To encrypt & decrypt file content in C++, you have to enter the file name with extension to encrypt & decrypt the content present inside the file. Now open that file using the function
c contains the number of columns for each of the n matrices. c[ 0 ] is the number of rows in matrix 1. Minimum number of multiplications is left in m[1][n]. Actual ordering is computed