Nov 6, 2013 at 10:21am UTC
well, i don't know why this is happening, but for some reason the for don't stop after the condition is true and keeps going like 3 or more times before ending, this is the code of the for i am using
1 2 3 4
for (int j=1; j<=id; j++){
cout<<ids[j]<<" || " <<art[j].nombreprod<<" | | " <<art[j].marca<<" | | " <<art[j].costo<<" | | " <<art[j].exist<<" | | " <<art[j].fecha<<" | | " <<art[j].caducidad<<" | | " <<art[j].unita<<endl;
}
edit:nevermind, found my mistake, a do while was making it repeat itself again and again, thanks anyways
Last edited on Nov 6, 2013 at 10:33am UTC
Nov 6, 2013 at 10:29am UTC
Are you sure the value of id is what you think it is?
Also, are you aware that arrays are indexed from 0, not 1, in C++? Your loop misses out the first element in your arrays.