# WEEK2 - Week2 BasicConcepts BIL106_WEEK2_2004 11 Data types...

This preview shows pages 1–10. Sign up to view the full content.

Click to edit Master subtitle style  BIL106_WEEK2_2004 11 Week 2   Basic Concepts

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

View Full Document
BIL106_WEEK2_2004 22 - Data types o There are five basic data types in fortran n 1) integer n 2) real n 3) complex n 4) character         n 5) logical Numerical-data types Strings of characters Logical data values Non- numerical data types
BIL106_WEEK2_2004 33 Integers o An Integer is a whole number (positive, negative, or zero) and does not contain commas or a decimal point. Examples for valid integer numbers are: 1 137 -1126 +17735 the followings are the examples for valid integer number: 8,675 (Commas are not allowed in numerical constants) 26.0 (Integer constants may not contain decimal points) --5 (Only one algebraic sign is allowed) 7- (The algebraic sign must precede the string of digits.)

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

View Full Document
BIL106_WEEK2_2004 44 Real o real  constant must contain a decimal point, but no commas are  allowed. Valid real constants are: 1.623 -0.03275 +55765.0 invalid real constants 15,627 (commas are not allowed in numerical constants.) 786     (Real constants must contain a decimal point.) a real constant can be represented by an exponential. An exponent  written as the letter E with an integer constant following. For example:
BIL106_WEEK2_2004 55 Complex o complex  number is represented as a pair of real (i.e., floating  point) numbers. The first component of the pair represents the real  part of the complex data object, and the second represents the  imaginary part. For example;                                 Z = a + i b                        NOTE: Since you don’t have enough background on complex numbers,  you are not responsible from complex numbers and its related examples.

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

View Full Document
BIL106_WEEK2_2004 66 Character string o Character constants , also called  strings , are sequences of  symbols from the ANSI standard character set for Fortran. o The number of a character constant between double quotes is the  length  of the constant For example:    ”PDQ123-A”       (Character constant of length 8)                        ”John Q. Doe”    (Character constant of length 11)
BIL106_WEEK2_2004 77 Logical type o An object of logical type has the value  true  or  false

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

View Full Document
BIL106_WEEK2_2004 88 Identifiers o Names used to identify programs,  constants, variables,  etc . o Identifiers must begin with a letter o This can be followed by up to 30 letters,  digits, undescores o Be careful with the case: lower or upper  case  letters
BIL106_WEEK2_2004 99 Identifiers o Examples Current Decay_Rate pressure an_identifier_with_a_long_name the_best_program

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 36

WEEK2 - Week2 BasicConcepts BIL106_WEEK2_2004 11 Data types...

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

View Full Document
Ask a homework question - tutors are online