|
-
March 6th, 2013, 12:26 PM
#1
nested loops to streamlined code
all,
in C++ right now, I have code similar to this (symantics may not be right, just ignore it. Example came from PHP):
Code:
If (ctr = 4) {
for (block = 1; block <= 27; block += 3) {
for (ctr2 = 1; ctr2 <= 3; ctr2++) { //each line.
for (ctr3 = 1; ctr3 <= 3; ctr3++) { //char 1 - 3 in each line.
switch (ctr2) { //which line?
Case 1:
strOut = strOut . substr(Line1, block - 1 + ctr3, 1);
Case 2:
strOut = strOut . substr(Line2, block - 1 + ctr3, 1);
Case 3:
strOut = strOut . substr(Line3, block - 1 + ctr3, 1);
}
}
}
}
}
I don't have a spreadsheet or anything set up to where I can identify all internal resources that C++ has to streamline this, either by mathematical means or method means.
can someone help me here in that regard? anyone know how can this be consolidated using C++ resources?
I never like writing long iterations, but as it just so happens, this can be done very rapidly without having to re-learn any given language with the purpose of using cleaner/better coding techniques.
any help appreciated. thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|