1

I've got the Problem in my Console Calculator :( I want to change the Size of the Console Window, but i get always the same error: CS1002, ; expected I don't really know much about C# since i'm a beginner, just for you as an advice ;)

I'm working currently with Microsoft's Visual Basic 2015.

Can somebody help me with that error? It's above the first Console.WriteLine();

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

namespace Taschenrechner

{

    class Program

    {

        static void Main()

        {
            Console.WindowHeight{50};
            Console.WindowWidth{213};

            Console.WriteLine("************ Konsolen-Rechner ************");
            Console.WriteLine("****** Programmiert von Cédric Jäggi *****");
            Console.WriteLine("******************************************\n");
            Console.WriteLine("Geben Sie bitte zwei Zahlen ein:");
            Console.Write("\nErste Zahl: ");

            double zahl1 = Convert.ToDouble(Console.ReadLine());

            Console.Write("\nZweite Zahl: ");

            double zahl2 = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Was möchten sie tun? * = multiplizieren + = addieren - = subtrahieren / = dividieren");

            char eingabe = Convert.ToChar(Console.ReadLine());

           switch (eingabe)

            {
                case '*':
                    Console.WriteLine((zahl1) + " * " + (zahl2) + " ist: " + (zahl1 * zahl2));
                    break;

                case '+':
                    Console.WriteLine((zahl1) + " + " + (zahl2) + " ist: " + (zahl1 + zahl2));
                    break;

                case '-':
                    Console.WriteLine((zahl1) + " - " + (zahl2) + " ist: " + (zahl1 - zahl2));
                    break;

                case '/':
                    Console.WriteLine((zahl1) + " / " + (zahl2) + " ist: " + (zahl1 / zahl2));
                    break;

                default:
                    Console.WriteLine("Sie dürfen nur *,+,-,/ eingeben");
                    break;

           }
            Console.WriteLine("Das Programm beendet sich nun...");
            Console.ReadLine();
        }
    }
}
0

1 Answer 1

6

Console.WindowHeight and Console.WindowWidth are properties:

To set them:

Console.WindowHeight = 50;
Console.WindowWidth = 213;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.