- 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}};

20th Apr 2021, 6:57 PM
Jyothiswaroop.K
Jyothiswaroop.K - avatar
2 Respostas
+ 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; }
20th Apr 2021, 7:11 PM
RKK
RKK - avatar
+ 2
Yup
25th Apr 2021, 4:07 AM
Jyothiswaroop.K
Jyothiswaroop.K - avatar