Kamis, 11 Desember 2025

listing3.9.cpp Displaying Directions

// listing3.9.cpp
#include <iostream>
using namespace std;

enum CardinalDirections
{
    North=25,
    South,
    East,
    West
};

int main()
{
    cout << "Displaying directions and their symbolic values" << endl;
    cout << "North: " << North << endl;
    cout << "South: " << South << endl;
    cout << "East: " << East << endl;
    cout << "West: " << West << endl;

    CardinalDirections windDirection=South;
    cout << "Variable windDirection= " << windDirection << endl;
    return 0;
}

output:
 
Displaying directions and their symbolic values
North: 25
South: 26
East: 27
West: 28
Variable windDirection= 26

Process returned 0 (0x0)   execution time : 0.476 s
Press any key to continue.

Tidak ada komentar:

Posting Komentar