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]
3 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]3 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
What is the most important thing you should avoid when you store files and folders?
iVinArrow [24]
Getting hacked by someone
4 0
3 years ago
How to turn off do not disturb on iphone for a contact.
Tresset [83]

Answer:

Okay so you turn your phone on scroll up and it well show everything click the moon and on the side of your phone there is alittle swice turn it right

Explanation:

3 0
2 years ago
Read 2 more answers
I need random facts about bill gates.
Andre45 [30]
He is the co founder of Microsoft
4 0
3 years ago
Which line of code will allow a decimal point to be stored in a variable?
Helga [31]

Answer:

a float value u mean right?Explanation:

8 0
3 years ago
Add a minimum of 3 comments to your code. These comments should help explain to other users what should be completed in your cod
Eva8 [605]

Answer:

And?hahahahahahahahahaahahahaha

4 0
2 years ago
Read 2 more answers
Other questions:
  • A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the
    15·1 answer
  • Write a function similar to keep_ints like before, but now it takes in a number n and returns a function that has one parameter
    8·1 answer
  • horseback riders, bicyclists, and skateboarders ____ the rules of right-of-way when they use the road ?
    7·2 answers
  • To copy both character attributes and paragraph attributes, such as alignment and indentation, select the entire paragraph. TRUE
    14·1 answer
  • Witch factor will increase a populations size
    6·2 answers
  • Write a static method called split that takes an ArrayList of integer values as a parameter and that replaces each value in the
    12·1 answer
  • Which case would benefit from Explainable Artificial Intelligence (AI) principles?
    5·2 answers
  • imagine that you wanted to write a program that asks the user to enter in 5 grade values. the user may or may not enter valid gr
    12·1 answer
  • I really need the answer now!!
    5·1 answer
  • What is boot sector virus​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!