C++ examples for Data Type:const
Using Constants for Permanent Values That Do Not Change
#include <iostream> #include <string> using namespace std; const int MyValue = 80; const string StoreName = "My Store"; const float pi = 3.1415926; int main() /*from www . j a v a2s. co m*/ { cout << "Here at " << StoreName << endl; cout << "we believe you should know" << endl; cout << "that we have " << MyValue; cout << " full-sized" << endl; cout << "parking spaces for your parking" << endl; cout << "pleasure." << endl; cout << endl; cout << "at " << StoreName << endl; cout << "spaces from " << MyValue << " to "; cout << MyValue * 2; float radius = 5; float area = radius * pi * pi; cout << "And remember, we sell " << radius; cout << " inch apple pies" << endl; cout << "for a full " << area << " square" << endl; cout << "inches of eating pleasure!" << endl; return 0; }