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
A ____ object is used to hold data that is retrieved from a database via the OleDbDataAdapter connection. a. DataRecord b. DataS
mariarad [96]

Answer:

datatable

Explanation:

3 0
3 years ago
Read 2 more answers
Software is nothing but a piece of code or set of instructions written in a chip to run a hardware device on the Computer. O Tru
yarga [219]

Answer:

True

Explanation:

Because it is a database that have not been process as information

5 0
3 years ago
Please Help! <br> I need good Anime to watch!
nirvana33 [79]

Answer:

attack on titan

kakegurui

kuroko's basketball

haikyuu

One piece

Mha

fruits basket

naruto

the great pretender

tokyo ghoul

Darling in the Franxx

Toradora

death note

Explanation:

5 0
3 years ago
Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What should Sherri
Schach [20]

Answer:

Option b, Option c, and Option d  are the correct options.

Explanation:

While Sherri is replacing the laptops processor because her's laptop working slow as compared to the past performance then, she decided to ensure to use the right processors for her laptop's motherboard. Then, she verifies that not under the warranty, and she also determines that the teardown procedure is available or not.

4 0
3 years ago
What does a transistor do?
mixas84 [53]

It Transmits electrical currents. You can use it as an amplifier or switch of currents.

5 0
3 years ago
Read 2 more answers
Other questions:
  • You can use Facebook's live feed tool to broadcast content as you post it
    8·2 answers
  • There are many differenttypes of models, but an individual DSS can consist of onlyone.
    15·1 answer
  • An ______ is a simplified image. [4 letters]​
    7·2 answers
  • ____________________ is the premeditated, politically motivated attacks against information, computer systems, computer programs
    6·2 answers
  • Which finger types the return or enter key?
    6·2 answers
  • Which of the following is NOT one of the Big 3 Google Applications that we discussed?
    9·2 answers
  • The name of a person their address and their contact information like phone number and email address or consider the minimum inf
    9·1 answer
  • What is the name for the size and style of text?
    8·2 answers
  • What is the code i need to do
    12·1 answer
  • WILL MARK BRAINLIEST WORTH ALOT OF POINTS! HELP ME GET THIS DONE
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!