对于循环重复,重复句子多次

编程入门 行业动态 更新时间:2024-10-24 20:22:58
本文介绍了对于循环重复,重复句子多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

写一个简单的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!

更多推荐

对于循环重复,重复句子多次

本文发布于:2023-11-22 20:57:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1618996.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:句子

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!