1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PIT_PIT [208]
3 years ago
5

2. Write a simple program in C++ to investigate the safety of its enumeration types. Include at least 10 different operations on

enumeration types to determine what incorrect or just silly things are legal. Now, write a C program that does the same things and run it to determine how many of the incorrect or silly things are legal. Compare your results.

Computers and Technology
1 answer:
erastovalidia [21]3 years ago
6 0

Answer:

Check the explanation

Explanation:

To solve the question above, we will be doing some arithmetic and bit wise operations on enum values. in addition to that, we are asserting the array with INTCOUNT  and also printing the size of array i.e 12 and we are adding BIG_COUNT enum value to 5 and the result is 25.

#include<stdio.h>

enum EnumBits

{

ONE = 1,

TWO = 2,

FOUR = 4,

EIGHT = 8

};

enum Randoms

{

BIG_COUNT = 20,

INTCOUNT = 3

};

int main()

{

// Basic Mathimatical operations

printf("%d\n",(ONE + TWO)); //addition

printf("%d\n",(FOUR - TWO)); //subtraction

printf("%d\n",(TWO * EIGHT)); //multiplication

printf("%d\n",(EIGHT / TWO)); //division

// Some bitwise operations

printf("%d\n",(ONE | TWO)); //bitwise OR

printf("%d\n",(TWO & FOUR)); //bitwise AND

printf("%d\n",(TWO ^ EIGHT)); //bitwise XOR

printf("%d\n",(EIGHT << 1)); //left shift operator

printf("%d\n",(EIGHT >> 1)); //right shift operator

// Initialize an array based upon an enum value

int intArray[INTCOUNT]; // declaring array

// Have a value initialized be initialized to a static value plus

int someVal = 5 + BIG_COUNT; //adding constant and BIG_COUNT variable

printf("%d\n",someVal); //value will be 25

printf("%d",sizeof(intArray)); //value will be 12

return 0;

}

Kindly check the attached image below for the Code and Output Screenshots:

You might be interested in
ROE: what does this represent (in plain terms)? In what range would this number typically be? What type of person/position would
LuckyWell [14K]

Answer:

<em>The ROE in plain terms is called  the return on equity (ROE) is a measure of inflow of profit in business in relation to the equity, also known as assets net worth  or assets of liabilities  ROE is a method  of how l  company generate earnings through investment </em>

Explanation:

<em>The ROE in plain terms is called  the return on equity (ROE) is a measure of inflow of profit in business in relation to the equity, also known as assets net worth  or assets of liabilities  ROE is a method  of how l  company generate earnings through investment </em>

<em>The ROE range number can be of any value or percentage example 15% upwards</em>

<em>The type of person or position with roles to play are usually a professional, such as an accountant, bookkeeper, or payroll processor, who completes ROEs on behalf of your clients in the organisation.</em>

4 0
3 years ago
A template slide that controls the formatting of all other slides in the presentation is called a _________.
PtichkaEL [24]

Answer:

the answer is slide master

7 0
2 years ago
Which type of footwear should be worn while working on a hybrid vehicle?
Dmitrij [34]

Hello there!

Shoes with rubber souls would be the best bet.

7 0
3 years ago
Read 2 more answers
What does the CMYK tab let you do
Paha777 [63]

<span>CMYK means cyan, magenta, yellow, and key (black). They are the four color model used in color printing or printing color images. It lets you subtract the colors on the image. CMYK partially or fully masks colors on a lighter view. </span>

3 0
3 years ago
Read 2 more answers
In a system with paging as the address translation mechanism, using multi-level paging always causes less memory usage for stori
Zarrin [17]

Answer:

The given statement is "True". A further explanation is given below.

Explanation:

  • Multi level paging can conserve storage capacity as opposed to sequential paging, including some of its hierarchical method Multi-level paging completing such.
  • Rather precisely, with either the aid of the number of co-association, clients will determine which unique category of 2²⁰ pages whose data are stored as well as the pick itself.
3 0
3 years ago
Other questions:
  • What are the Database used in RDBMS and DBMS<br>please answer immediately​
    10·1 answer
  • Date criteria are automatically enclosed in ____ when entered in a query design.
    11·1 answer
  • Radio and television are examples of
    9·1 answer
  • Create two classes. The first, named Sale, holds data for a sales transaction. Its private data members include the day of the m
    8·1 answer
  • You are the leader of a team at work. What type of leader would you like to be – one that gets involved and works with the team
    15·2 answers
  • NAT ________. allows a firm to have more internal IP addresses provides some security both allows a firm to have more internal I
    5·1 answer
  • Define Agricultural Era
    14·2 answers
  • What would provide structured content that would indicate what the code is describing ?
    6·1 answer
  • On a wireless network use _____ to ensure that only authorized client computers are able to access the wireless network.
    10·1 answer
  • 2. When you establish a connection to a remote host using Remote Desktop Connection, what appears at the top of the screen that
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!