简单算法问题,高手快来拿走20分!先写先得啊 打印以下图案:***** ***** ***** ***** *****简单算法问题,高手快来拿走20分!先写先得啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如下:using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { string[] sArray = { "*****", " *****", " *****", " *****", " *****" }; foreach(string i in sArray) { Console.WriteLine(i); } } }} static void Main(string[] args) { for(int i=0;i<5;i++) { for(int k=0;k<=i;k++) { Console.Write(" "); } for(int j=0;j<5;j++) { Console.Write("*"); } Console.WriteLine(""); } }如上... for (int i=0;i<10;i++){ string a = "***"; a.PadLeft(i + a.Length, ' '); MessageBox.Show(a);} 不好意思,这类的题目我最拿手了,一激动,按错了,重来static void Main(string[] args){Console.WriteLine("*****");Console.WriteLine(" *****");Console.WriteLine(" *****");Console.WriteLine(" *****");Console.WriteLine(" *****");} 这好象用不到算法吧直接用Console.WriteLine()打印出来就OK鸟 private void Out(string Pstr,int PnRow){ for(int i = 1;i<= PnRow;i++) { Console.WriteLine(Pstr + "\n"); Pstr = " " + Pstr; }}private void main(){ string str = "*****"; //输出字符串 int nRow = 6; //输出行数 Out(str,nRow);} private void Out(string Pstr,int n,int PnRow) //Pstr字符串,n每行的个数,PnRow行数{ string str = ""; for(int j = 1;j<=n;j++) { str += Pstr; } for(int i = 1;i<= PnRow;i++) { Console.WriteLine(str + "\n"); str = " " + str; }}private void main(){ string str = "*"; //输出字符 int n = 5; int nRow = 6; //输出行数 Out(str,n,nRow);}这个可能更好点 求如何在 winform 窗体中代码创建控件? 【c#中】const int LBN_DBLCLK=???16进制值为多少 DataGridView 导出数据 DataGridViewComboBoxCell WINFORM 自适应分辨率问题. 如何实现UDP进程监控 如何让c#实现类似 on error resume next的功能? 斑竹,结不了贴了 前辈谁知道在c#里怎么将含逻辑意义的字符串转换成bool C#构造方法中的调用顺序和在其中调用虚方法 C#中取整的函数是什么?(相当于C++的floor/cell) 如何优化这段查询代码 在C/S三层架构中如何使用Remoting技术?
using System.Collections.Generic;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] sArray = {
"*****",
" *****",
" *****",
" *****",
" *****"
}; foreach(string i in sArray)
{
Console.WriteLine(i);
}
}
}
}
{
for(int i=0;i<5;i++)
{
for(int k=0;k<=i;k++)
{
Console.Write(" ");
}
for(int j=0;j<5;j++)
{
Console.Write("*");
}
Console.WriteLine("");
}
}
如上...
{
string a = "***";
a.PadLeft(i + a.Length, ' ');
MessageBox.Show(a);
}
static void Main(string[] args)
{
Console.WriteLine("*****");
Console.WriteLine(" *****");
Console.WriteLine(" *****");
Console.WriteLine(" *****");
Console.WriteLine(" *****");
}
直接用Console.WriteLine()打印出来就OK鸟
{
for(int i = 1;i<= PnRow;i++)
{
Console.WriteLine(Pstr + "\n");
Pstr = " " + Pstr;
}
}private void main()
{
string str = "*****"; //输出字符串
int nRow = 6; //输出行数
Out(str,nRow);
}
{
string str = "";
for(int j = 1;j<=n;j++)
{
str += Pstr;
} for(int i = 1;i<= PnRow;i++)
{
Console.WriteLine(str + "\n");
str = " " + str;
}
}private void main()
{
string str = "*"; //输出字符
int n = 5;
int nRow = 6; //输出行数
Out(str,n,nRow);
}这个可能更好点