Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ PROGRAM 1.) Consider the following structure declaration: struct registered

ID: 3694884 • Letter: C

Question

C++ PROGRAM

1.) Consider the following structure declaration:

struct registered { string title;

int isbn;

int quantity;

float price;

} chem1, maht3, prog2;

How to initial the title of chem1?

A) cout << "Enter the title of chem1 " << endl; cin >> chem1.title;

B) cout << "Enter the title of chem1 " << endl; getline(cin, chem1.title);

C) cout << "Enter the title of chem1 " << endl;getline(cin, chem1 -> title);

D) cout << "Enter the title of chem1 " << endl; cin >> prog2.title;

2)

struct point { char c;

int x; int y; };

void display (point * k)

{ cout << " Coordinates of point " << (*k).c << " are " << (*k).x << " and " << (*k).y << " "; }

int main() { point s; s.c = 'M'; s.x = 3; s.y = 4; display(&s);

system("pause") ;

return 0;}

In the code snippet above, the structure point M is initialized (3, 4) and displayed (as: coordinates of M are 3 and 4) passing the argument by

A) value

B) reference

C) address

D) void

Explanation / Answer

Structuer is a grouped list of variables under one name in block of memory,allowing the different variables accessed by a single pointer.It usually allows to combine data items of different kinds i.e heterogeneous.

1. C

2. A

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote