Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Float, double
Enumeration
Reference
Data Types
Type Typical Bit Width Typical Range
-127 to 127
-2147483648 to 2147483647
0 to 4294967295
-2147483648 to 2147483647 -32768 to 32767 0 to 65,535 -32768 to 32767
Type
long int signed long int unsigned long int float double
Typical Range
-2,147,483,647 to 2,147,483,647 same as long int 0 to 4,294,967,295 +/- 3.4e +/- 38 (~7 digits) +/- 1.7e +/- 308 (~15 digits)
long double
char unsigned char
8bytes
1byte 1byte
INPUT/OUTPUT (I/O)
C++ supports input/output statements which can be used to feed new data into the computer or obtain output on an output device such as: VDU, printer etc.
The following C++ stream objects can be used for the input/output purpose. 1. cin - console input 2. cout - console output
Output Operator
The statement [cout << C++ is better than C;] causes the string in quotation marks to be displayed on the screen. cout is a predefined object that represents the standard output stream in C++.
The operator << is called insertion operator inserts the contents of the variable on its right side to the object on its left. Cout << varname;
Input Operator
The statement [cin >> num1 ] is an input statement and causes the program to wait for user input for a number.
The >> operator is called Extraction operator
Declaration of Variable
C++ allows the declaration of variable anywhere in the scope.
A variable can be declared right at the place of its first use
Program NO. 7 : Input Price, Qty and calculate bill amount with discount of 5.00% if price is greater than 50
Program No. 8
Input a number and display factorial value using loop statement Factorial : A factorial of a nonnegative number n is the product of all positive integers less than or equal to n