Question: C++ PROGRAM 1.) Consider the following structure declaration: struct registered { string title; int isbn; int quantity; float price; } chem1, maht3, prog2; How to
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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
