浏览 2410 次
锁定老帖子 主题:c++ 递归实例二
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-05-18
#include <iostream.h> //using namespace std; void show(unsigned int n); int main(void) { for(;;) { int t; cout << "Please enter an num : " ; cin >> t; if(t < 0) break; else { cout << "The result is : "; show(t); }//end else cout << endl; }//end for(;;) cout << "\nThank you for testing...Bye!!!\n" << endl; }//end main void show(unsigned int n) { if(n>=10) { show(n/10); cout << ' '; }//end if cout << n%10; }//end function show(unsigned int n) 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |