Same Program Using Constant Integers : const « Language Basics « C++ Tutorial

Home
C++ Tutorial
1.Language Basics
2.Data Types
3.Operators statements
4.Array
5.Development
6.Exceptions
7.Function
8.Structure
9.Class
10.Operator Overloading
11.Pointer
12.File Stream
13.template
14.STL Introduction
15.string
16.vector
17.list
18.bitset
19.set multiset
20.valarray
21.queue stack
22.deque
23.map multimap
24.STL Algorithms Modifying sequence operations
25.STL Algorithms Non modifying sequence operations
26.STL Algorithms Binary search
27.STL Algorithms Sorting
28.STL Algorithms Merge
29.STL Algorithms Min Max
30.STL Algorithms Iterator
31.STL Algorithms Heap
32.STL Algorithms Helper
C / ANSI-C
C Tutorial
C++
Visual C++ .NET
C++ Tutorial » Language Basics » const 
1.8.5.Same Program Using Constant Integers
#include <iostream>
int main()
{
   const int Sunday = 0;
   const int Monday = 1;
   const int Tuesday = 2;
   const int Wednesday = 3;
   const int Thursday = 4;
   const int Friday = 5;
   const int Saturday = 6;

   int today;
   today = Monday;

   if (today == Sunday || today == Saturday)
      std::cout << "\nGotta' love the weekends!\n";
   else
      std::cout << "\nBack to work.\n";

   return 0;
}
1.8.const
1.8.1.Define constant
1.8.2.Demonstrates constants
1.8.3.const double value
1.8.4.Using a properly initialized constant variable.
1.8.5.Same Program Using Constant Integers
1.8.6.Demonstrating the const type qualifier
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.