[英]Why do I get a “Compiler Error Message: CS1002: ; expected” error message at site?
[英]Compiler Error CS1002 ; expected C#
我在控制台計算器中遇到了問題:(我想更改控制台窗口的大小,但是我總是遇到相同的錯誤: CS1002;;由於我是初學者,所以我對C#的了解並不多,僅供您參考;)
我目前正在使用Microsoft的Visual Basic 2015。
有人可以幫我解決這個錯誤嗎? 它在第一個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
和Console.WindowWidth
是屬性:
設置它們:
Console.WindowHeight = 50;
Console.WindowWidth = 213;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.