如何在一个Messgae Box中打印完整的低三角星 [英] How Do I Get Full Lower Triangle Of Stars Printed In One Messgae Box
本文介绍了如何在一个Messgae Box中打印完整的低三角星的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void button1_Click(object sender, EventArgs e)
{
Console.WriteLine("LOWER LEFT TRIANGLE");
for (int i = 0; i <= 5; i++)
{
for (int j = 0; j < i; j++)
{
MessageBox.Show("*");
//Console.Write("*");
}
Console.WriteLine();
}
}
推荐答案
MessageBox的Show方法接收要显示的字符串,所以你有将你的星星放入一个字符串(包括换行符)并将其发送到方法...
这样的东西...
MessageBox's Show method receives a string to display, so you have to put your stars into a string (including new-line) and send it to the method...
Something like this...
string sz = "";
for (int i = 0; i <= 5; i++)
{
for (int j = 0; j < i; j++)
{
sz += "*";
}
sz += Environment.NewLine;
}
MessageBox.Show(sz);
这篇关于如何在一个Messgae Box中打印完整的低三角星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文