0
C++.How can I save every value in the loop?
I want to make loop and every time it have to save old values. Example i want to making coordinates .like input: up/down/left/right in loop and moving point in coordinates so it must save values every time. I tried "goto ...; " but it simple restarts everything. So is there any way?
3 Respuestas
+ 2
Store the values in a data structures, maybe an array.
+ 1
If you want the loop to never end, you can make infinite loop like:
while(1){}
Or
for(;;){}
And inside the body of the loop save values to some array/vector or any other container you like. But I guess you have to declare that container before entering the loop, other way it will reset with every iteration
0
Understand. Ty ill try it.