- #1
needOfHelpCMath
- 72
- 0
May anyone help guide and explain this program for meAssign the size of vector sensorReadings to currentSize.
Testing sensorReadings.resize(10)
Your value: 10
✖ Testing sensorReadings.resize(2)
Expected value: 2
Your value: 10
Code:
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> sensorReadings(4);
int currentSize = 0;
sensorReadings.resize(10);
currentSize = 10;
cout << "Number of elements: " << currentSize << endl;
return 0;
}
Your value: 10
✖ Testing sensorReadings.resize(2)
Expected value: 2
Your value: 10