- 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 odpowiedzi
+ 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
Yup