|
At the heart of every program is its variables. In this respect, though, C++
has many differences when compared to Pascal. For instance, in Pascal, when
you declare a variable, you say the name and then the type
(ie, "
Pascal C++ Description
Boolean bool "TRUE" or "FALSE" only
Char char Single Character ('A', 'g', '1', etc)
Integer int Integer (10, -53, 5524, 0, etc)
Real double Real Number (0.3, 2.123, -121.1, etc)
Note that the names of the C++ equivalent are both shorter and all lowercase. Now, let's look at how you declare these variables in C++ versus Pascal: Pascal:a : Boolean; b : Char; c : Integer; d : Real;C++: bool a; char b; int c; double d;
Note the way characters are represented: Note that the way C++ declares variables is backwards from the way Pascal does it, and no colon is involved. It may take a little getting used to, but it's really not so bad. |