Updated function to match description

This commit is contained in:
2020-07-11 13:36:34 -04:00
parent 9a64623008
commit 077e265de3

View File

@@ -343,7 +343,7 @@ std::vector<T> getAllFib(const T num){
tempNums[0] = tempNums[1] = 1;
//Do the calculation and add each number to the vector
for(T cnt = 2;(tempNums[(cnt - 1) % 3] < num) && (tempNums[(cnt - 1) % 3] >= tempNums[(cnt - 2) % 3]);++cnt){
for(T cnt = 2;(tempNums[(cnt - 1) % 3] <= num) && (tempNums[(cnt - 1) % 3] >= tempNums[(cnt - 2) % 3]);++cnt){
tempNums[cnt % 3] = tempNums[(cnt + 1) % 3] + tempNums[(cnt + 2) % 3];
fibList.push_back(tempNums[cnt % 3]);
}