//Program based on chapter 2 illustrates implicit type coercion (mentioned in chapter 3), integer division and mod operator //It also shows how characters can be treated as integers //Carol Conway 8/27/17 #include using namespace std; int main() { int i = 8, j = 3; float z = 123.65432; char achar = 'A', bchar; int k; bchar = achar + 1; //arithmetic performed on characters uses their ASCII codes cout << "bchar: " << bchar << endl; k = achar; cout << "The ACSII code for 'A' is " << k << endl; //implicit type conversion of char to int, its underlying type! cout << i << " divided by "<< j << " is " << i/j << endl; cout << i " mod " << j << "is " << i % j << endl; cout << "z is " << z << endl; i = z; cout << "i is " << i << endl; //implicit type conversion float to int // bchar = "B"; //this will not compile return 0; }