Now off the top here, what do you mean you have a problem? Simply extend the boundaries of your for loops to include the int values for the uppercase letters. Since there are some chars you would not want in there [92 to 96] simply make an if clause before assigning to num
Something on the lines of
That is not the prettiest code I have seen, certainly. You could use a constant declaration for all the values you would use.Code:for (int counter = 65; counter < 123; counter ++) { for (int count =65;count < 123; count ++) if(count!=92 && count!=93... && counter!=92...) //you get the working here { num[0] = counter; num[1] = count; a_file<< num << endl; } }
Then you could simply loop through this array and assign to count/counter the int value of each elementCode:int values[52]={65,66,67,68...};
As said, this is only off the top hereCode:for (int counter = 0; counter < 52; counter ++) { for (int count =0; count < 52; count ++) { num[0] = values[counter]; num[1] = values[count]; a_file<< num << endl; } }
[edit]
reply was written during previous post. I'm not sure about the a_file << num but it does look a little odd. also, depending on your compiler the type cast could or could not be done inherently. it is recommended that you use the method outlined in the post above.
as a note, it is helpful if you actually say what problem you are having. compiler output error, if it's a bug etc. it really speeds up the process.
[/edit]






Reply With Quote