|
From: Rob P. <py...@ea...> - 2002-10-22 16:44:05
|
OK, I'm back for more information. I'm looking at a slightly different way
of building the database I asked about yesterday.
The examples I have seen for a structure are typically a database. Here's
the one I have seen posted on several newbie sites:
#include <iostream.h>
struct database
{
int id_number;
int age;
float salary;
};
int main()
{
database employee;
employee.age=22;
employee.id_number=1;
employee.salary=120000.21;
return 0;
}
My question is this; this struct as it is written will only hold one
record, and all of the entries are int's. If I wanted to have multiple
records using the same struct, can I create a struct array (correct
terminology?) like this:
struct database[100]
{
int id_number;
char employee_name[25];
int age;
float salary;
};
To populate it, or to access the individual records within the array, I
would use the standard for() loops, correct? Same with the emplyee_name[]
array?
Thanks all,
--->Rob
|