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]
2 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]2 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
Which command would you use to swap the words hither and yon on any line with any number of words between them? (You need not wo
REY [17]

Answer:

The command i will use in carrying out such function is

Explanation;

Kindly check the attached file for the command as it can not be written fully in the answer box.

3 0
3 years ago
14 Copy a picture of a crane on the next page. Do not trace them. Make a freehand sketch. (2) 2 Look at the placed where the Mar
PtichkaEL [24]

Answer:

Hope it helps.have a look.

3 0
2 years ago
Isabela wants to modify one of her paragraphs. However, she does not find the command she needs in the Paragraph group. She know
cluponka [151]

Answer:

Editing button

Explanation:

Editing is changing therefore if she wants to modify her work she would be changing it.

Hope that helped :)

5 0
3 years ago
Read 2 more answers
In what machines, places and apparatus are dimmers used in? Put at least 5 examples
dangina [55]

4 Types Of Dimmers :

1. Incandescent/Halogen

2. Magnetic Low Voltage (MLV)

3. Fluorescent

4. Light Emitting Diode (LED)

These are the different types of switches :

1. A single-pole switch controls lights from a single location. ...

2. A 3-way switch provides two separate control locations and is best used with recessed lights. ...

3. A 4-way switch provides for three or more dimming locations.

4. Switches are wired to the "hot" conductor in a wall box.

<em>I hope that my answer helps!</em>

7 0
2 years ago
When you take a multiple-choice test, you are relying on ________, a means of retrieving information out of your long-term memor
miv72 [106K]

Answer:

recognition

Explanation:

<h2><u>Fill in the blanks</u></h2>

When you take a multiple-choice test, you are relying on <u>recognition</u> , a means of retrieving information out of your long-term memory storage system that helps you choose the correct answer.

4 0
2 years ago
Other questions:
  • Information is a valuable asset and not everyone in the world can be trusted with it. Therefore, we need to protect our valuable
    10·1 answer
  • You’re responding to a troubleshooting ticket about a laser printer in HR that isn’t working. According to reports, the printer
    7·1 answer
  • Write a method called swapPairs that switches the order of values in an ArrayList of strings in a pairwise fashion. Your method
    9·1 answer
  • The acceleration of a body is 3 metre per second square what does it mean​
    11·2 answers
  • How can an Excel table be added to a Word document? Check all that apply.
    15·1 answer
  • What is single user operating system? Write two examples.​
    12·2 answers
  • Zack sees an online contest. He could win $10,000 instantly! On the sign-up form he enters his name and email address. He is als
    9·1 answer
  • There are many best practices for digital recordings. Select the three best practices from the list below. select the best micro
    14·1 answer
  • What is a thoughtware​
    7·1 answer
  • 30 Points!!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!