In a C++ book I am reading it says to use nested for() loops to create a program that prints every ASCII character to the screen then does the same thing using two digits printing every possible combination i.e. a b c
aa ab ac ba bb bc ca cb cc
etc.
it works fine but sometimes I get the odd out of place character over about 10 spaces from everything else. I dunno if this matters but I was wondering if anyone knew why this was happening
Code:
#include <iostream.h>
#include <stdlib.h>
void two();
int main()
{ for(int i=1; i<255; i++)
{ cout<<"\n" << (char)i;
}
cout<<"\n\n";
system("PAUSE");
two();
cout<<"\n\n";
system("PAUSE");
return 0;
}
void two()
{ cout<<"\n\n*******************************************";
for(int a=1; a<255; a++)
{
for(int k=1; k<255; k++)
{cout<<"\n";
cout<<(char)k;
cout<<(char)a;
}
}
}