ok, I have 3 nested for loops and I want to start at a particular point in the loop. what recommendations can you give me?
here is a sample code:
in my sample code, I have 3 nested for loops and it prints from "1234" to "9999" because I added an if statement to change some values. however, the if statement would slow down the nested for loops because it would be checked every time during a loop. any suggestion on another solution?Code:int main() { int a,b,c,d; for(a=0;a<10;a++) for(b=0;b<10;b++) for(c=0;c<10;c++) for(d=0;d<10;d++) { if((a==0)&&(b==0)&&(c==0)&&(d==0)) { a=1,b=2,c=3,d=4; } cout<a<<b<<c<<d; } }
can the use of static work for this situation? if so, how?



LinkBack URL
About LinkBacks


