So, I decided to test out a new C++ turtle-style graphics library. I decided to test it out by making the fibonacci spiral. however, upon running the program, it stops in the middle. I checked what was going on, and the fibonacci value had reversed to -2147483647, as if it was compiled in 32-bit. Can someone please help? I compiled it with g++ on Windows. Note: I was using a vector to store the values. Here's my code:
//Includes and namespaces
#include "Cturtle.hpp"
#include<iostream>
namespace ct = cturtle;
std::vector<long int> fibonacci = {1, 2}; //This vector stores the fib sequence
ct::TurtleScreen scr; //Create a new Screen
ct::Turtle turtle(scr); //Create a new turtle on the screen
int main() {
turtle.speed(ct::TS_FASTEST); //Set the turtle's speed to max
while(true) {
for(int i = 0; i < fibonacci.back(); i++) {
fibonacci.push_back(fibonacci.back() + fibonacci.back()-1); //Add a new value to the fibonacci vector based off the previous two
std::cout << fibonacci.back() << '\n'; //This is here for debug
turtle.forward(1); //Move the turtle 1 step forward
turtle.right(90 / fibonacci.back()); //Turn according to 90 divided by the current fibonacci value
}
}
}