Hi, I am working on a simple project that calculates resistance and voltage. I just don't understand what it means by this.
"Repeat part 4, except this time, instead of using a 2 dimensional array to store
the test data, use a 1 dimensional array of structs, where r1, r2, r3, and I are
individual fields in the struct."
I need help with what it means by a 1 dimensional array of structs. Here is what I have but it looks so redundant.
Is there a more compact way to do this, or is this it?
struct circuit
{
int r1;
int r2;
int r3;
int I;
};
int main ()
{
cout << "enter your r1, r2, r3 and I fields for each object\n";
int tempr1, tempr2, tempr3, tempi;
circuit array [10];/// array of ten struct objects
for (int i=0; i <10: i++)
{
cin>> arry [i].r1>> array[i].r2>> array [i].r3>>array [i].I ;
}
}