233k views
0 votes
Consider the following statements: struct rectangleData { double length; double width; double area; double perimeter; }; rectangleData bigRect; Which of the following statements is valid in C++?

a. cout << bigRect;
b. cin >> bigRect.length >> width;
c. cout << length;
d. cout << bigRect.length;

User Timcbaoth
by
5.2k points

1 Answer

2 votes

Answer:

The answer to this question is the option "d".

Explanation:

In the given C++ programming language code. The structure is a collection of heterogeneous elements. It is similar to class because both(class and structure) holds a collection of different data types. In the structure, the struct keyword is used to defines a structure. The syntax of the structure can be given as:

Syntax:

struct structure-name

{

//different types of variables.

char name[50];

int age;

float salary;

}[create a structure variable];

In this question the valid statement for c++ code is

"cout << bigRect.length;". In this code we create a structure variable and call the variable length.

User Leighton
by
5.4k points