简体   繁体   中英

Compiler Error CS1002 ; expected C#

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();
        }
    }
}

Console.WindowHeight and Console.WindowWidth are properties:

To set them:

Console.WindowHeight = 50;
Console.WindowWidth = 213;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM