// A sample program to explore a variety of data types. // // This program declares several variables of varying types, and makes // some initial assignments to the value of the underlying objects using // the syntax of "constants" (aka "literals") of the given data types. // // Author: Michael H. Goldwasser // Date: 18 January 2005 #include #include // the 'string' type is not truly built-in, but using namespace std; // rather is previously defined in a set of // standard libraries that can be used with // C++. These two lines inform that compiler // that we wish to use the string class which // is defined in such a library. int main() { // Example of some declarations short sectionNumber; int populationUS; long nationalDebt; float pi; double acceleration; char firstInitial; string name; // Example of some assignments to these variables sectionNumber = 38; populationUS = 295279654; nationalDebt = 7599584015246; // As of 14 Jan 2005 (rounded to nearest dollar) pi = 3.141592653589793; acceleration = 6.67E-11; firstInitial = 'M'; // Note the use of single-quote punctuation name = "Michael H. Goldwasser"; // Note the use of double-quote punctuation }