分类: C/C++
2005-02-28 13:20:02
前几天写的。
程序是生成包括5位的数字,小写字母的组合.
可以很容易的进行扩充.
#include
int main(void)
{
int a,b,c,d,e,f,g;
for (a = 0; a < 123; a++)
for (b = 0; b < 123; b++)
for (c = 0; c < 123; c++)
for (d = 0; d < 123; d++)
for (e = 0; e < 123; e++) {
if ((a > 9) && (a < 97))
continue;
if ((b > 9) && (b < 97))
continue;
if ((c > 9) && (c < 97))
continue;
if ((d > 9) && (d < 97))
continue;
if ((e > 9) && (e < 97))
continue;
(a <= 9) ? (printf("%d", a)) : (printf("%c", a));
(b <= 9) ? (printf("%d", b)) : (printf("%c", b));
(c <= 9) ? (printf("%d", c)) : (printf("%c", c));
(d <= 9) ? (printf("%d", d)) : (printf("%c", d));
(e <= 9) ? (printf("%d", e)) : (printf("%c", e));
printf("
");
}
exit(0);
}