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 builtin
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) )
Data Type Description
String
Group of characters
A character is stored in one byte (8 bits) via its ASCII (ANSI code).
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.
 Spring '08
 CarolRoberts
 ASCII

Click to edit the document details