Question: Help with building a simple vecotr. I am getting an error when I try to store the values. Thanks const int SIZE = 10; //

Help with building a simple vecotr. I am getting an error when I try to store the values. Thanks

const int SIZE = 10; // Number of elements

int count; // Loop counter

// Create a SimpleVector of ints.

MyStaticArray intTable(SIZE);

// Create a SimpleVector of doubles.

MyStaticArraydoubleTable(SIZE);

// Store values in the two SimpleVectors.

for (count = 0; count < SIZE; count++)

{ intTable[count] = (count * 2); //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray' and 'int')

doubleTable[count] = (count * 2.14); //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray' and 'int')

}

How do I fix those two error.

intTable[count] = (count * 2; //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray' and 'int')

doubleTable[count] = (count * 2.14; //Error: Use of overloaded operator '[]' is ambiguous (with operand types 'MyStaticArray' and 'int')

This vecotr object: intTable[count] calls the setter operaotor.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!