How can I use this code repeatedly?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 51
Reputation: Manutebecker is an unknown quantity at this point 
Solved Threads: 2
Manutebecker's Avatar
Manutebecker Manutebecker is offline Offline
Junior Poster in Training

How can I use this code repeatedly?

 
0
  #1
Dec 3rd, 2008
for(int n = 0; n<blocksx;n++){
for(int x = 0; x<blocksy;x++){

I just want to be able to shorten this into something easy so I could just type in like one word to get it to work, it is used a lot and sucks to retype... thx
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,508
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1480
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: How can I use this code repeatedly?

 
0
  #2
Dec 3rd, 2008
you could put it in a function so that it can be called as many times as you like.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 6
Reputation: smeezekitty is an unknown quantity at this point 
Solved Threads: 0
smeezekitty smeezekitty is offline Offline
Newbie Poster

Re: How can I use this code repeatedly?

 
0
  #3
Dec 3rd, 2008
simple, like this
  1. int go() {for(int n = 0; n<blocksx;n++){
  2. for(int x = 0; x<blocksy;x++){
  3. return 0;
  4. }
now evrey time you use go();
it will call and run
Last edited by smeezekitty; Dec 3rd, 2008 at 10:40 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 51
Reputation: Manutebecker is an unknown quantity at this point 
Solved Threads: 2
Manutebecker's Avatar
Manutebecker Manutebecker is offline Offline
Junior Poster in Training

Re: How can I use this code repeatedly?

 
0
  #4
Dec 3rd, 2008
thx, but I need to be able to put data into those for statements and theres no call for them in the function, wouldn't I need to use a typedef or something like that?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,508
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1480
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: How can I use this code repeatedly?

 
0
  #5
Dec 3rd, 2008
We have no clue what you intend to put in those for statements, therefore no one can really answer your question. You could create a template, a function, or even a macro, all depends on what you want to do with it.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC