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
Phantasy [73]
2 years ago
13

Given the code segment below, complete the assignments as stated in the comments. struct aaa { int m; int nn; } struct bbb{ stru

ct aaa myfield; int sum; } struct bbb myvar; // write one statement to place the integer value 44 into the field sum of structure variable myvar . // write one statement to place the integer value -17 into the field nn of structure variable myvar .
Computers and Technology
1 answer:
grin007 [14]2 years ago
6 0

Answer:

  1. using namespace std;
  2. struct aaa {
  3.    int m;
  4.    int nn;
  5. };
  6. struct bbb{
  7.    struct aaa myfield;
  8.    int sum;  
  9. };
  10. struct bbb myvar;
  11. int main()
  12. {
  13.    myvar.sum =44;
  14.    myvar.myfield.nn = -17;
  15.    
  16.    cout<<myvar.sum<<"\n";
  17.    cout<<myvar.myfield.nn<<"\n";
  18.    return 0;
  19. }

Explanation:

Given two data structures (Line 2-9), we can set the value of 44 to field of sum structure variable myvar by using a dot syntax

                      myvar.sum = 44

To assign value to field of nn of structure in myvar, we need to access the myfield of myvar and then followed by nn. Hence, the statement shall be

                     myvar.myfield.nn = -17

In short the we can always use the dot syntax the access the value of an inner field of a particular data structure.

You might be interested in
The application layer in the tcp/ip protocol suite is usually considered to be the combination of ________ layers in the osi mod
navik [9.2K]
Application Presentation and Session Layers.
8 0
3 years ago
A vast global network that is made up of many smaller interconnected networks is known as:
Galina-37 [17]

The answer is The Internet.   It is a vast global network that is made up of many smaller interconnected networks. It connects to millions of computer units world wide, in which any computer can communicate with any other computer as long as they are both connected to the Internet. It also made access to information and communication easier.

6 0
3 years ago
Read 2 more answers
What is a coverage map used for
erastova [34]

Answer/Explanation:

A coverage map shows how much land something takes up or reaches to.

4 0
2 years ago
Read 2 more answers
Write a definition in your own words for Raster Graphic. Do not copy and paste please.
Vlada [557]

Answer:

Raster Graphic is a bitmap. They are basically a grid of small pixels that make an image.

6 0
3 years ago
Write a program that asks the user how many numbers will be entered and then has the user enter those numbers. When this is done
KATRIN_1 [288]

Answer:

<em>The program written in Python 3 is as follows;</em>

<em>The program does not make use of comments; however, see explanation section for detailed line by line explanation of the program</em>

num = int(input("Number of Inputs: "))

mylist = []

userinput = int(input("Enter a digit: "))

i = 1

while i < num:

     mylist.append(userinput)

     userinput = int(input("Enter a digit: "))

     i += 1

   

try:

     first7 = mylist.index(7)+1

     print('The first position of 7 is ',first7)

     last7 = num - 1 - mylist[::-1].index(7)

     print('The last position of 7 is ',last7)

except:

     print('7 is not on the list')

Explanation:

This line prompts user for the number of inputs

num = int(input("Number of Inputs: "))

This line declares an empty list

mylist = []

This line inputs the first number into the empty list

userinput = int(input("Enter a digit: "))

The italicized lines represent an iteration that allows user to input the numbers into the empty list.

<em>i = 1</em>

<em>while i < num:</em>

<em>      mylist.append(userinput)</em>

<em>      userinput = int(input("Enter a digit: "))</em>

<em>      i += 1</em>

The try-except is used to check the presence of 7 in the list

try:

This checks the first occurrence of 7

     first7 = mylist.index(7)+1

This prints the first occurrence of 7

     print('The first position of 7 is ',first7)

This checks the last occurrence of 7

     last7 = num - 1 - mylist[::-1].index(7)

This prints the last occurrence of 7

     print('The last position of 7 is ',last7)

The following is executed if there's no occurrence of 7

except:

     print('7 is not on the list')

See Attachments for sample runs

7 0
2 years ago
Other questions:
  • Your boss bought a new printer with a USB 3.0 port, and it came with a USB 3.0 cable. Your boss asks you: Will the printer work
    14·1 answer
  • divide the input array into thirds (rather than halves), recursively sort each third, and finally combine the results using a th
    15·1 answer
  • The concept of ____ refers to the idea that the internet is designed for all content to be treated equally.
    12·1 answer
  • Which of the following software programs provides for e-mail communication?. A. Access. B. Word Perfect. C. Outlook. D. Excel
    15·2 answers
  • Why does a thermostat blade bend when heated or cooled?
    9·1 answer
  • Write a program that repeatedly shows the user a menu to select the shape form three main shapes or to print the shapes created
    15·1 answer
  • Write a void method named myMethod which prints "This is a void method" (without the quotes). Your method should be declared pub
    5·1 answer
  • What is phishing?
    14·1 answer
  • How to create drop down list in excel with multiple selections.
    13·2 answers
  • What can be used to help diagnose and fix computer hardware problems?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!