Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2549488
  • 博文数量: 351
  • 博客积分: 76
  • 博客等级: 上将
  • 技术积分: 3555
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-13 21:27
文章分类

全部博文(351)

文章存档

2013年(1)

2012年(4)

2011年(7)

2010年(16)

2009年(34)

2008年(34)

2007年(34)

2006年(68)

2005年(82)

2004年(71)

分类: 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);
}

阅读(3206) | 评论(7) | 转发(0) |
给主人留下些什么吧!~~