C#で2つの文字列アートパターンを並べて表示しようとしています。文字列のアートパターンを並べて表示する方法#
はたぶんそこuがASCIIコードでこれを行うことができます方法は存在するが、どのようにそれが動作する電子
私はそれを行うにはいくつかの方法を知っていると私はすべてを試みたが、それはそれぞれに重なっその他、BCSストリング構造これは私が持っている「花」で、その不規則な:
..O..
O.o.O
..O..
私はConsole.WriteLine()
方法を試してみました、それはそれを印刷します1つの列に表示されます。
など、私のコードを見て:
Console.OutputEncoding = Encoding.ASCII; //maybe this can be done in ASCII too.
int r = Convert.ToInt32(Console.ReadLine()); // the flowers row
int c = Convert.ToInt32(Console.ReadLine()); //the flowers col
string flower = @"..O..
O.o.O
..O..";
string s1 = string.Concat(Enumerable.Repeat(flower + "\n", r)); //i multiply this string with the coefficent "r"
string final = string.Concat(Enumerable.Repeat(s1, c)); //i tried to concat the first one with that got generated and in this way i wanted to get flower in col and rows , like matrixes u know
string s2 = string.Concat(s1); //tried to concat them , this works for simple strings but not for my kind of string
私はこのようなSTHを取得したい、 R = 2、C = 5 印刷は次のようになります。
..O....O....O....O....O..
O.o.OO.o.OO.o.OO.o.OO.o.O
..O....O....O....O....O..
..O....O....O....O....O..
O.o.OO.o.OO.o.OO.o.OO.o.O
..O....O....O....O....O..
しかし、これらのメソッドを使用する代わりに、灰色の文字が重なり合って1列と 'r'行に印刷されます。列部分に問題があり、並んで表示されます。
誰でも手伝ってもらえますか?
私はそれを感謝します!
ありがとう、それは魅力のように動作します – gocci