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 computer is completely compromised when it wont turn on or operate. What is the best way to fix
miskamm [114]

There really is no getting it back, if it is from a virus, then you need to buy a new computer. If it is something internal, depending on what type of computer you have it might just be best to buy a new one. Hope this helps :-)

8 0
3 years ago
Read 2 more answers
Andy wants to add a script on his website that will automatically update the current date when the script loads in the browser.
FrozenT [24]
The script that Andy would want to use is Javascript, here is the source code: document.getElementById("para1").innerHTML = formatAMPM();
function formatAMPM() {var d = new Date(),    minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes(),    hours = d.getHours().toString().length == 1 ? '0'+d.getHours() : d.getHours(),    ampm = d.getHours() >= 12 ? 'pm' : 'am',    months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],    days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];return days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes+ampm;<span>}

The HTML code needed to call this Javascript on his website is this: </span><span><div id="para1"></div>
</span>
You could call the Javascript up using PHP.

Hope this helps! Good luck! :) 
8 0
3 years ago
A storyboard is used to outline the sequence of key content on a website
juin [17]

Answer:

what else is there

Explanation:

6 0
3 years ago
If you create a keyIterator and a valueIterator for the same dictionary,a. the number of items in keyIterator is smaller than th
irga5000 [103]

Answer:

b. the number of items in keyIterator is equal to the number of items invalueIterator

Explanation:

A dictionary in python is an unordered and unindexed data structure. It stores data in key-value pairs, this means that for every key in a dictionary, there must be a value. A keys() method is used to create an iterator of dictionary keys. The items of this iterator can be used in a list comprehension, using the dictionary name and the item key to get the values of the dictionary, creating a list of the dictionary values. The values attribute can also be used for this purpose but cannot be used to get the keys.

5 0
3 years ago
I pressed a button on my MacBook safari and all my tabs disappeared. What happened?
hodyreva [135]
Maybe try resetting your Macbook I do not have a Macbook I have a Toshiba laptop but that happen to me before where all the tabs basically zoom in. To zoom out in your tabs press CTRL and (-) at the same time. Or if that does not work try resetting. Best of luck!


8 0
3 years ago
Other questions:
  • ____ allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing
    11·2 answers
  • Which is the correct process for selecting an entire row in a spreadsheet?
    15·2 answers
  • The drone intercepts at 1256 hour. what time do they plane to take control of the drone
    11·1 answer
  • You have been found at fault in a crash where someone was injured and was transported to a medical treatment facility. By law yo
    15·2 answers
  • When you select a state abbreviation from a combo box, how does the form control record your selection?
    8·1 answer
  • When the PT-109 American patrol boat, under the command of Lieutenant John F. Kennedy, was sunk by a Japanese destroyer, a messa
    15·1 answer
  • Please help ASAP, will mark brainliest!
    7·1 answer
  • Is Missouri a free state or a slave state​
    13·2 answers
  • Assume a large shared LLC that is tiled and distributed on the chip. Assume that the OS page size is 16KB. The entire LLC has a
    8·1 answer
  • ফাইল ও ফোল্ডারের মধ্যে পার্থক্য কি এবং ৫ টি ইনপুট ডিভাইসের নাম কি​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!