对于循环重复,重复句子多次 [英] For loop repetition that repeats sentence however many times

查看:115
本文介绍了对于循环重复,重复句子多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

写一个简单的For循环,询问他们想要显示某条消息的次数。在输入此号码时,程序会多次打印出该消息。



我尝试了什么:



我尝试了各种各样的方法,但我不明白我该怎么做请

Write a simple For Loop that asks how many times they would like to display a certain message. On entering this number the program then prints out the message that many times.

What I have tried:

I have tried various ways but i just dont understand it how do i do it please

推荐答案

这是你的作业:所以我不给你任何密码!



但是这很简单,如果你从上一课中读到你的笔记。

有两个以下部分:

1)询问用户打印消息的次数,并将响应作为数字。

2)循环多次打印消息。



现在,我很确定你可以打印一条消息,我有理由相信你已经被告知如何阅读回复。将其转换为数字也不复杂: Int32.TryParse方法(字符串,Int32)(系统) [ ^ ]将为您完成。



所以您需要的是For循环。同样,这很简单: For ... Next Statement( Visual Basic)| Microsoft Docs [ ^ ] - 页面底部有一些示例,几乎可以完全按照您的要求进行操作!
This is your homework: so I'll give you no code!

But this is pretty simple, if you read your notes from the last lesson.
There are two sections to this:
1) Ask the user how many times to print the message, and get the response as a number.
2) Loop that many times to print the message.

Now, I'm pretty sure you can print a message, and I'm reasonably sure you have been told how to read a response. Converting that to a number isn't complicated either: Int32.TryParse Method (String, Int32) (System)[^] will do it for you.

So all you need to to is a For loop. Again, that's simple: For...Next Statement (Visual Basic) | Microsoft Docs[^] - there are examples at the bottom of the page which pretty much do exactly what you want!


这篇关于对于循环重复,重复句子多次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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