thats because you dont actually call your display/output routine. Perhaps you should change this
part_rec Robot_parts[ ] = {
{7789, "QTI", 4, 12.95},
{1654, "bolt", 4, 0.34},
{6931, "nut", 4, 0.25}
};
cout<<" enter 'e' to exit";
cin>>ch;
to
part_rec Robot_parts[ ] = {
{7789, "QTI", 4, 12.95},
{1654, "bolt", 4, 0.34},
{6931, "nut", 4, 0.25}
};
display(Robot_parts);
cout<<" enter 'e' to exit";
cin>>ch;
[edit]
this :-
void display(part_rec *Robot_parts[])
{
int i;
for(i = 0; i<3; i++)
cout<<setw(5)<<Robot_parts[i]->part_num;
cout<<setw(7)<<Robot_parts[i]->part_name;
cout<<setw(5)<<Robot_parts[i]->part_quantity;
cout<<setw(10)<<Robot_parts[i]->part_cost;
return;
}
would be 'nicer' / ? more correct as
void display(part_rec *Robot_parts[])
{
for(int i = 0; i<3; i++)
{
cout<<setw(5)<<Robot_parts[i]->part_num;
cout<<setw(7)<<Robot_parts[i]->part_name;
cout<<setw(5)<<Robot_parts[i]->part_quantity;
cout<<setw(10)<<Robot_parts[i]->part_cost;
}
return;
}
and instead of hardcoding 3 as the number of elements in the array, you could probably (to make your program future safe)
int numberOfParts = sizeof(Robot_parts) / sizeof(Robot_parts[0]);
and then use that like
for(int i = 0; i<numberOfParts; i++)
or pass the number of elements in the array into the display(...) function
[/edit]
[edit 2 - warning bells in my head]
doing this
int numberOfParts = sizeof(Robot_parts) / sizeof(Robot_parts[0]);
is fine, but, I dont think it can be done from within display(...) so, that means you do something like this
int numberOfParts = sizeof(Robot_parts) / sizeof(Robot_parts[0]);
display(Robot_parts, numberOfParts);
and change the declaration of display() to
void display(part_rec *Robot_parts[], int numberOfParts)
[/edit2]