/* This program demonstrates: * 1. Declaring, initializing and using variables of different primitve types * 2. The char type for single character data * 3. Different ways of representing an integer - decimal, octal, hexadecimal * 4. The 2 major floating point types - float and double * 5. Fixed and scientific notations for floating point numbers * 6. The cin object, used to read values into a variable. * */ #include #include // required for precision using namespace std; int main() { /* bool is the C++ boolean type. It can only hold one of two values: * true and false. * 0 is interpreted as "false", Anything not 0 is "true" * C++ will print 1/0 instead of true/false * "true" and "false" are c++ keywords. */ bool ans; ans = true; cout<<"ans = "<< ans << endl; /* The char type is an integer type that can be used to store * single characters. The character stored in a char variable * must be in single quotes. The value in the char variable is * not associated in any way with the name of the variable. * Any single keystroke character can be stored in a char variable */ char letter; // declaration letter = 'B'; //initialization cout<<"letter: "<>letter; cout<<"User entered: "<> x >> y >> a; /* We can now use those values in our calculations */ double sum = x + y + a; cout<<"Sum: "<