-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeDefIntroDEMO.cpp
More file actions
40 lines (32 loc) · 1.04 KB
/
Copy pathTypeDefIntroDEMO.cpp
File metadata and controls
40 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//************************************************************************
// Author: Rolando Carreon
// Date: 25 mar 2025
// Language: C++
// Assignment: TypeDefIntroDEMO
// Description: demonstarte TypeDef
//************************************************************************
#include<iostream>
using namespace std;
// define enumerations
// starts from 0 so PLAYING = 3
enum CurrentGameStatus { WIN, LOSS, TIE, PLAYING };
// define data type aliases ( typedef )
// type def shortens names for datatypes while keeping the data
typedef CurrentGameStatus CGS;
// unsigned integer can use postive or negative (+ or -)
// signed can only go up to 127 to -128 1 byte value,
// unsigned can go up to 255 1 byte value
// unsigned is barely used
typedef unsigned int uInt;
typedef std::string str;
int main()
{
// declare local variables
uInt num = 42;
str name = "John Doe";
CGS game = PLAYING;
cout << "Number: " << num << endl;
cout << "Name: " << name << endl;
cout << "Game Status: " << game << endl;
return 0;
}