Write a namespace, Currency, that defines constant members ONE, TWO, FIVE, TEN, TWENTY, FIFTY and HUNDRED. Write two short programs that use Currency. One pro- gram should make all constants available and the other should make only FIVE available.

What will be an ideal response?


```
// Program makes namespace members accessible.
#include
using namespace std;

// create namespace Currency
namespace Currency
{
enum Money { ONE = 1, TWO, FIVE = 5, TEN = 10,
TWENTY = 20, FIFTY = 50, HUNDRED = 100 };
} // end namespace Currency

int main()
{
using namespace Currency; // use Currency namespace

cout << "TWO's value is: " << TWO
<< "\nTEN's value is: " << TEN << endl;
} // end main
```
TWO's value is: 2
TEN's value is: 10
```
// Program makes one namespace member accessible.
#include
using namespace std;

// create namespace Currency
namespace Currency
{
enum Money { ONE = 1, TWO, FIVE = 5, TEN = 10,
TWENTY = 20, FIFTY = 50, HUNDRED = 100 };
} // end namespace Currency

int main()
{
using Currency::FIVE; // use Currency FIVE

cout << "FIVE's value is: " << FIVE << endl;
} // end main
```
FIVE's value is: 5

Computer Science & Information Technology

You might also like to view...

When you paste a selection, it is removed from its original location and placed it in the Clipboard

Indicate whether the statement is true or false

Computer Science & Information Technology

One function that is often overlooked during recovery is ________

A) accounts receivable B) payroll C) disaster assessment D) backup

Computer Science & Information Technology

____________________, also called concentrators, expand one Ethernet connection into many.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Regular expressions have the general form denoted as _____. 

A. *pattern* B. [pattern] C. /pattern/ D. //pattern//

Computer Science & Information Technology