Reputation: 63
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();
}
}
}
Upvotes: 1
Views: 2532
Reputation: 12201
Console.WindowHeight
and Console.WindowWidth
are properties:
To set them:
Console.WindowHeight = 50;
Console.WindowWidth = 213;
Upvotes: 6