Input你的喊话,由空格隔开Output回荡的回声SampleInputIloveyouforeverSampleOutputIloveyouforeverloveyouforeveryouforeverforever像上面那样的...
Input
你的喊话,由空格隔开
Output
回荡的回声
SampleInput
I love you forever
SampleOutput
I love you forever
love you forever
you forever
forever
像上面那样的
C#回声程序怎么编写
答案:1 悬赏:60 手机版
解决时间 2021-01-03 11:48
- 提问者网友:趣果有间
- 2021-01-03 02:55
最佳答案
- 五星知识达人网友:老鼠爱大米
- 2021-01-07 01:21
这个很简单的,要多动动脑。
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();
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();
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯