C#回声程序怎么编写

C#回声程序怎么编写,第1张

这个很简单的,要多动动脑

string inputStr = Console.ReadLine()

string temp=inputStr

int index = inputStr.IndexOf(" ")

Console.WriteLine(inputStr)

while (index != -1)

{

temp = temp.Substring(index+1)

Console.WriteLine(temp)

index = temp.IndexOf(" ")

}

Console.ReadLine()

你理解错误了,键盘输入数据是读 *** 作而不是写 *** 作。

System.in返回的是标准的输入流,就是用来接收键盘输入的数据的。你说的OutputStream是输出流,而且是一个经过封装了的输出流,标准输出流是System.out。

至于如果不用构造方法,那可以另外写个方法来传递输入流对象嘛


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/11694202.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存