Which type of structure we used | Sololearn: Learn to code for FREE!

-1

Which type of structure we used

typedef struct { int h; int w; int l; } box; int main() { box boxes[3] = {{2, 6, 8}, {4, 6, 6}, {2, 6, 9}};

4/20/2021 6:57:25 PM

Jyothiswaroop.K

4 Answers

New Answer

+1

What is your doubt? Something like this? #include <iostream> using namespace std; typedef struct { int h; int w; int l; } box; int main() { box boxes[3] = {{2, 6, 8}, {4, 6, 6}, {2, 6, 9}}; for(int i = 0; i < 3; i++){ cout << "Box " << (i+1) << endl; cout << "height: " << boxes[i].h<< endl; cout << " width: " << boxes[i].w<< endl; cout << "length: " << boxes[i].l<< endl; cout << endl; } return 0; }

+2