Building a Struct & Struct Arrays

I have struct called part_rec, and each one will be recorded in a struct array called Robot_parts[]. I am not sure if i should include (Robot_parts[]) this in the struct part_rec function, since I have to initialize
part_rec Robot_parts[ ] = {{ 7789, "QTI", 4, 12.95},
{1654, "bolt", 4, 0.34},
{6931, "nut", 4, 0.25}};
in main()

I don't know where to declare Robot_parts and if I need [] after the defined members I have in the struct part_rec part (example: int part_num[0]). If I do, I don't know the number value to put in the brackets.

So far I have:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>

using namespace std; 
void display(struct part_rec);

struct part_rec
{
  int part_numl
  string part_name;
  int part_quantity;
  double part_cost;
};

int main()
{
   part_rec Robot_parts[ ] = {
                              {7789, "QTI", 4, 12.95},
                              {1654, "bolt", 4, 0.34},
                              {6931, "nut", 4, 0.25} 
                                                    };
return 0;
}

void display()
{
  cout<<Robot_parts[]<<endl<<endl;
}


If I also made a few other errors, please let me know. Thanks!
Topic archived. No new replies allowed.