Click here to Skip to main content
15,923,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I want to load 15 image files using a for loop.
C++
ViewAdd("Assets/xx.png", Boxes[0][0], Boxes[0][1]);


where xx vary form 01 to 16
and Boxes[i][j] are the x and y coordinates where image file is to be loaded.
now how can i load them using a loop instead of writing the same line again and again..
Thankyou

[edit]Urgency deleted: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response. - OriginalGriff[/edit]
Posted
Updated 24-Dec-11 20:26pm
v3
Comments
Ghost_x 25-Dec-11 4:35am    
@OriginalGriff .. okay sorry about that.. im new here.
i'll make sure i dont write it again..
thanks anyways

1 solution

C++
char s[64];
for(i=1;i<=16;++i)
{
sprintf(s,"Assets/%02d.png",i);
ViewAdd(s,.....
}
 
Share this answer
 
v2
Comments
Richard MacCutchan 25-Dec-11 3:38am    
Use <pre> tags around code samples.
Ghost_x 25-Dec-11 4:34am    
Thanks it worked
i followed this tut too
http://www.rohitab.com/discuss/topic/11505-sprintf-tutorial-in-c/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900