我们可以编写没有循环的程序 [英] can we write program without loops

查看:61
本文介绍了我们可以编写没有循环的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以编写程序,在不使用

开关的情况下写入1到n,执行,while,for,goto,if和条件运算符,其中n将是

用户输入。

解决方案

Saurabh Saxena写道:

我们可以编写程序写入1到n不使用
开关,执行,while,for,goto,if和条件运算符,其中n将由用户输入。




你的全班同学到NG寻求帮助是什么? :-)


使用递归 - ''Nuff说


-

gabriel


gabriel< no@no--spam.com>这样说:

Saurabh Saxena写道:

我们可以编写程序写入1到n不使用
开关,执行,while,for,goto,if和条件运算符,其中n将由用户输入。



使用递归 - ''Nuff说




你如何在不使用条件的情况下停止递归?


-

Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我

ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。


2004年2月5日星期四16:44:12 +0000(UTC),Christopher Benson-Manica

< at ***@nospam.cyberspace.org>写道:

gabriel< no@no--spam.com>这样说:

使用递归 - ''Nuff说



如何在不使用条件的情况下停止递归?




短路。


-

#include< standard.disclaimer>

_

Kevin D Quitt USA 91387-4454所有统计数据的96.37%组成

根据FCA,此地址可能不会添加到任何商业邮件列表中


can we write the program to write no 1 to n without using
switch,do,while,for,goto,if and conditional operator where n will be
input by user.

解决方案

Saurabh Saxena wrote:

can we write the program to write no 1 to n without using
switch,do,while,for,goto,if and conditional operator where n will be
input by user.



What, is your whole class coming to the NG for help? :-)

Use recursion -- ''Nuff said

--
gabriel


gabriel <no@no--spam.com> spoke thus:

Saurabh Saxena wrote:

can we write the program to write no 1 to n without using
switch,do,while,for,goto,if and conditional operator where n will be
input by user.


Use recursion -- ''Nuff said



How will you stop recursing without using conditionals?

--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.


On Thu, 5 Feb 2004 16:44:12 +0000 (UTC), Christopher Benson-Manica
<at***@nospam.cyberspace.org> wrote:

gabriel <no@no--spam.com> spoke thus:

Use recursion -- ''Nuff said



How will you stop recursing without using conditionals?



Short-circuiting.

--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list


这篇关于我们可以编写没有循环的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆