COS120 LECTURE 3 - COS120 Chapter 3.4 Strings Data Types:...

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

View Full Document Right Arrow Icon
1 COS120 Chapter 3.4 Strings Data Types: The programmer must specify the type of data that will be stored in a variable. Each data type is stored using a unique format and has available to it a certain set of operators and built-in functions. Data Type Description Range Intege r Whole numbers Approx. +/- 2 billion Double Larger floating point numbers 14 digits of precision Some math functions include: CInt (string) return the integer value equivalent to the string of digits CDbl (string ) return the double value equivalent to the string of digits Int (double) return the whole integer after truncating the decimal portion Ex. Int (4.5) 4 Math.Sqrt (number) return the square root of the number Ex. Math.Sqrt (9) 3 Math.Round (number,n) return the value of the number rounded to the specified number digits to the right of the decimal point. Ex. Math.Round (2.317, 1) 2.3 Note: Math is an object that has associated function (methods). Each of the functions is invoked by writing the name of the object, period ( . ), and the name of the function with its parentheses and arguments (ex. Math.Sqrt (9.4) )
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

COS120 LECTURE 3 - COS120 Chapter 3.4 Strings Data Types:...

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

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