c#程序改错,实现将输入的字符串逆序输出
namespaceConsoleApplication1{classProgram{staticvoidMain(string[]args){strings;s=Cons...
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
CharArray[] t = Convert.ToCharArray(s);
for (int m = 0; m < t.Length; m++)
Console.WriteLine(Convert.ToString(t[m]));
Console.ReadLine();
}
}
} 展开
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
CharArray[] t = Convert.ToCharArray(s);
for (int m = 0; m < t.Length; m++)
Console.WriteLine(Convert.ToString(t[m]));
Console.ReadLine();
}
}
} 展开
2个回答
展开全部
CharArray[] t = Convert.ToCharArray(s); 这也错了。是要按输入的倒序出错么?
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
char[] t = s.ToCharArray();
for (int m = t.Length-1; m >=0 ; m--)
Console.WriteLine(Convert.ToString(t[m]));
Console.ReadLine();
}
}
}
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
char[] t = s.ToCharArray();
for (int m = t.Length-1; m >=0 ; m--)
Console.WriteLine(Convert.ToString(t[m]));
Console.ReadLine();
}
}
}
展开全部
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
CharArray[] t = Convert.ToCharArray(s);
for (int m = 0; m < t.Length; m++)
Console.WriteLine(Convert.ToString(t[ t.Length - m]));
Console.ReadLine();
}
}
}
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
CharArray[] t = Convert.ToCharArray(s);
for (int m = 0; m < t.Length; m++)
Console.WriteLine(Convert.ToString(t[ t.Length - m]));
Console.ReadLine();
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询