Functions

/Users/garethloy/Musimathics/Musimat1.2/MusimatTutorial/B0103.cpp File Reference

#include "MusimatTutorial.h"

Go to the source code of this file.

Functions

 MusimatTutorialSection (B0103)

Function Documentation

MusimatTutorialSection ( B0103   )

Definition at line 2 of file B0103.cpp.

References x, and y.

                              {
        Print("*** B.1.3 Data Types ***");
        /*****************************************************************************
         
         B.1.3 Data Types
         
         To begin, we need only two types of numbers, Integer, which is a positive or negative whole 
         number, and Real, which is an approximate real number. To keep things simple, let's assume for 
         our purposes that we have virtually unlimited precision for computations. As we go along, I intro-
         duce additional data types as needed.
         
         *****************************************************************************/
        
        Integer x;              // This statement introduces a variable "x" which can store an integer.
        x = 3;                  // This statement assigns the value 3 to integer "x".
        Integer y = 7;  // We can combine steps: we define y as an Integer and assign it the value 7.
        
        Real pi = 3.14; // Real variables can store real numbers
        Real pi2 = 22.0/7.0; // We can initialize variables with expressions.
        
        // Now let's print out the values we just created
        Print("x=", x);
        Print("y=", y);
        Print("pi=", pi);
        Print("pi2=", pi2);
}