简体   繁体   English

编译器错误CS1002; 预期的C#

[英]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 ;) 我在控制台计算器中遇到了问题:(我想更改控制台窗口的大小,但是我总是遇到相同的错误: CS1002;;由于我是初学者,所以我对C#的了解并不多,仅供您参考;)

I'm working currently with Microsoft's Visual Basic 2015. 我目前正在使用Microsoft的Visual Basic 2015。

Can somebody help me with that error? 有人可以帮我解决这个错误吗? It's above the first Console.WriteLine(); 它在第一个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: Console.WindowHeightConsole.WindowWidth是属性:

To set them: 设置它们:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么会收到“编译器错误消息:CS1002:; 预期”错误消息在站点? - Why do I get a “Compiler Error Message: CS1002: ; expected” error message at site? Unity Engine 中 C# 脚本中的 CS1002 和 CS0116 显示错误 - Showing error in CS1002 and CS0116 in C# script in Unity Engine 错误 CS1002: ; 预期 - 我有一个分号。 :( - Error CS1002: ; Expected — I have a semicolon. :( c#来自javascript变量错误的变量分配(CS1002 :;预期) - c # variable assignment from javascript variable error (CS1002:; expected) 错误 CS1002: ; 预期和错误 CS1520:方法必须具有返回类型 - error CS1002: ; expected and error CS1520: Method must have a return type 错误CS1002 :; 预期&(31,13):错误CS1525:无效的表达式术语'else' - error CS1002: ; expected & (31,13): error CS1525: Invalid expression term 'else' TFS Build -Error CS1002:; 预期和错误CS1519无效令牌 - TFS Build -Error CS1002: ; expected and Error CS1519 Invalid token unity Assets\\script\\Produce.cs(10,20): 错误 CS1002: ; 预期分辨率 - unity Assets\script\Produce.cs(10,20): error CS1002: ; expected resolution CS1002; 预期的。 我有一个分号 - CS1002 ; Expected. I have a semicolon CS1026 :)预期| CS1002 :; 预期 CS1513:}预期 - CS1026: ) Expected | CS1002: ; expected | CS1513: } expected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM