1: //datatypes_simple.cpp 2: //C++ code examples illustrating simple data types 4: //Some declarations of variables of simple types: 5: int n; 6: int numberOfGuesses; 7: char ch; 8: char firstLetter; 9: float costPerUnit; 10: bool isValid; 11: bool everythingOK; 13: //Some initializations of variables of simple types: 14: int sum = 0; 15: int maxNumberOfGuesses = 10; 16: char topGrade = 'A'; 17: char period = '.'; 18: char tabChar = '\t'; 19: float balance = 0.0; 20: double smallValue = 1.23e-20; 21: bool finished = false; 23: //Some definitions of named constants: 24: const float PI = 3.14159; 25: const double TAX_RATE = 0.15; 26: const int SIZE = 100; 28: //Simple typedefs can enhance code readbility 29: typedef int BowlingScore; 30: typedef double Dimension; 31: BowlingScore myScore, yourScore; 32: Dimension length, width, height;