declarations

declarations - Programming Declarations 02 Prog....

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Declarations
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
102 Prog. Fundamentals I: Declarations/ Slide 2 General form of a C++ program // Program description #include directives int main(){ constant declarations variable declarations executable statements return 0; }
Background image of page 2
102 Prog. Fundamentals I: Declarations/ Slide 3 C++ Data Type A type defines a set of values and a set of operations that can be applied on those values. The set of values for each type is known as the domain for the type. C++ contains 5 standard types: v o i d i n t c h a r f l o a t b o o l S t a n d a r d D a t a T y p e s
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
102 Prog. Fundamentals I: Declarations/ Slide 4 void The void type has no values and no operations. In other words, both the set of values and the set of operations are empty. Although this might seem unusual, we will see later that it is a very useful data type.
Background image of page 4
102 Prog. Fundamentals I: Declarations/ Slide 5 Integer An integer type is a number without a fractional part. It is also known as an integral number. C++ supports three different sizes of the integer data type: short int , int and long int . sizeof( short int )<= sizeof( int )<= sizeof( long int ) Short int int long int
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
102 Prog. Fundamentals I: Declarations/ Slide 6 Integer The type also defines the size of the field in which data can
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/30/2010 for the course COMP COMP102 taught by Professor Lrr during the Fall '09 term at HKUST.

Page1 / 14

declarations - Programming Declarations 02 Prog....

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online