static void Main(string[] args) { try { Box box = new Box(); box.draw(20, 5, 8, 5, '.', "Hello, world!"); Console.WriteLine("Press any key..."); // Console.WriteLine("The square of the box is: " + box.Square()); //... and recursive factorial Console.WriteLine("Enter the integer to compute it's factorial:"); int num = int.Parse(Console.ReadLine()); Console.WriteLine("Factorial " + num + " is: "+FactorialClass.Factorial(num)); } catch (Exception) { Console.WriteLine("Error!"); } }
static void Main(string[] args) { try { Box a = new Box(); Console.WriteLine("Type position of the box, x = "); a.X = uint.Parse(Console.ReadLine()); Console.WriteLine("Type position of the box: y = "); a.Y = uint.Parse(Console.ReadLine()); Console.WriteLine("Type width of the box: width = "); a.Width = uint.Parse(Console.ReadLine()); Console.WriteLine("Type height of the box: height = "); a.Height = uint.Parse(Console.ReadLine()); Console.WriteLine("Type symbol (*,+,$,#,@) :"); a.Symbol = char.Parse(Console.ReadLine()); Console.WriteLine("Type the message : "); a.Message = Console.ReadLine(); a.Draw(); Console.WriteLine(a.Message); Console.WriteLine(); Console.WriteLine("Type integer value:"); Console.WriteLine("Factorial = {0}", factorial(int.Parse(Console.ReadLine()))); Console.ReadLine(); } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("invalid parameters!"); Console.ReadLine(); } }
static void Main(string[] args) { try { Box box1 = new Box(); Console.WriteLine("Type position of the box, x = "); box1.x_pos = uint.Parse(Console.ReadLine()); Console.WriteLine("Type position of the box, y = "); box1.y_pos = uint.Parse(Console.ReadLine()); Console.WriteLine("Type width of rectangle: "); box1.width = uint.Parse(Console.ReadLine()); Console.WriteLine("Type heigth of rectangle"); box1.height = uint.Parse(Console.ReadLine()); Console.WriteLine("Choose a char from: *, +, . "); box1.borderSymbol = char.Parse(Console.ReadLine()); Console.WriteLine("Type your massage: "); box1.message = Console.ReadLine(); string s = box1.message; Console.Clear(); box1.DrawRectangle(); Console.WriteLine("Enter nuber for fuctorial: "); int fact = int.Parse(Console.ReadLine()); Console.WriteLine("!{0} = {1}", fact, Factorial(fact)); } catch (Exception) { Console.WriteLine("Error!"); } }