
































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































































4
simple types
integral floating
char short int long bool enum float double long double
unsigned
7
4
Examples 18.4 500. .8 -127.
Examples 1.84E1 5E2 8E-1 -.127358E
10
//******************************************************* // FreezeBoil program // This program computes the midpoint between // the freezing and boiling points of water //******************************************************* #include < iostream > using namespace std; const float FREEZE_PT = 32.0; // Freezing point of water const float BOIL_PT = 212.0; // Boiling point of water int main() { float avgTemp; // Holds the result of averaging // FREEZE_PT and BOIL_PT
11
cout << “Water freezes at “ << FREEZE_PT << endl; cout << “ and boils at “ << BOIL_PT << “ degrees.” << endl;
avgTemp = FREEZE_PT + BOIL_PT; avgTemp = avgTemp / 2.0;
cout << “Halfway between is “; cout << avgTemp << “ degrees.” << endl;
return 0; }
13
int age;
age = 8;
age = age + 1;
age
age
14
int age;
age = 8;
++age;
age
age
16
int dogs;
dogs = 100;
dogs--;
dogs
dogs
17
dogs--; --dogs;
USE EITHER
variables, constants, and operators
compute a value of a given type
9.3 * 4.5 is 41.