mirror of
https://bitbucket.org/Mattrixwv/my-classes.git
synced 2025-12-06 18:23:57 -05:00
Updated function to match description
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user