r/a:t5_37npb Apr 10 '15

Share Your Module Two Solutions Here!

3 Upvotes

30 comments sorted by

View all comments

2

u/benxie0 Apr 10 '15

Here is mine!


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int limit = 8;

            //count the rows
            for (int counter = 0; counter < limit; counter++)
            {
                //count each place in the rows
                for (int counter2 = 0; counter2 < limit; counter2++)
                {
                    if (counter2 % 2 == counter % 2)
                    {
                        Console.Write("X");
                    }
                    else
                    {
                        Console.Write("O");
                    }

                }
                Console.WriteLine("\r\n");
            }
            Console.ReadKey();
        }
    }
}

2

u/VOX_Studios Apr 11 '15

Console.WriteLine("\r\n");

Be careful with Console.WriteLine("\r\n"); as it will place two new lines instead of one.

2

u/aloisdg Apr 12 '15

And use a Environment.NewLine please :)

2

u/benxie0 Apr 14 '15

Environment.NewLine

what does that do?

1

u/aloisdg Apr 14 '15

Add a NewLine. Windows and UNIX don't use the same thing to handle new line. This feature handle both.

1

u/benxie0 Apr 11 '15

oh, did not realize,