jfo planet

Hope is the best gift that tomorrow gives.

  • 首页
  • 分类
  • 归档
  • 标签
  • 搜索
close

【zz】输出1,2,...,100,99,...,2,1

发表于 2007-11-03   |   分类于 c/c++/algorithm

www.cppblog.com/shifan3/archive/2007/11/02/35767.html

输出1,2,…,100,99,…,2,1
短路算法和逗号表达式粉墨登场了,一行搞定~

#include <cstdio>

void f(int i,int n)
{
     printf("%dn",i),(i<n)&&(f(i+1,n),printf("%dn",i));
}

int main()
{
     f(1,100);
}


编写操作系统之使用GRUB multiboot
The ELF Auxiliary Table
  • 文章目录
  • 站点概览
jfo

jfo

605 日志
38 分类
4 标签
RSS
GitHub 微博
友情链接
  • 收藏夹
  • 网络剪贴板
  • 爱逛吧

此文章未包含目录

© 2007 - 2018 jfo
由 Hexo 强力驱动
主题 - NexT.Pisces