Du musst jetzt nur noch die Fehlerabfragen und die Ausgabe für den Kalender hinzufügen.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int month, year, day;
string read;
Console.WriteLine("Write \"exit\" to exit.\n");
do
{
//get month
Console.Write("month: ");
read = Console.ReadLine();
//ToDo check for errors
month = Convert.ToInt32(read);
//get year
Console.Write("year: ");
read = Console.ReadLine();
//ToDo check for errors
year = Convert.ToInt32(read);
//get day of week of the 1st day of month
DateTime dateValue = new DateTime(year, month, 1); //year, month, day
day = (int)dateValue.DayOfWeek; //sunday = 0, monday = 1, ..., saturday = 6
//if (dateValue.Year >= current year && dateValue.Year <= 3000)
/*print calendar*/
//else print error
} while (Console.ReadLine() != "exit");
}
}
}