programe
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace PersonalJournalApp
{
class PersonalJournal
{
List PersonDetails = new List();
public class Login
{
public string Email { get; private set; }
public string Password { get; private set; }
// Μέθοδος εγγραφής νέου χρήστη
public void Register()
{
Console.WriteLine("Please enter your email to register:");
string email = Console.ReadLine();
string emailPattern = @"^[^@\s]+@[^@\s]+\.[^@\s]+$";
// Έλεγχος αν το email ταιριάζει με το μοτίβο
while (!Regex.IsMatch(email, emailPattern))
{
Console.WriteLine("Invalid email format. Please try again:");
email = Console.ReadLine();
}
Console.WriteLine("Please enter your password:");
string password = Console.ReadLine();
// Αποθήκευση στοιχείων μετά από επιτυχή εγγραφή
this.Email = email;
this.Password = password;
Console.WriteLine("Registration successful!");
}
}
public static void Main(string[] args)
{
Console.WriteLine("\nWelcome to your personal private Journal");
Login login = new Login();
login.Register();
Console.WriteLine("\nRegistration complete. You have successfully registered with the email: " + login.Email);
//κσλεσε τις αλλες κλασεις
Console.ReadKey();
}
}
}
calendar
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace CcharpAskiseis
{
public class calendar
{
string[] monthsofAyear = { "January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December" };
string[] daysOfTheWeek = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
public void monthlyCalendar()
{
string[,] myArray = new string[2, 12]
{
{ "January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December" },
{ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri" }
};
for (int rows = 0; rows < myArray.GetLength(0); rows++)
{
for (int columns = 0; columns < myArray.GetLength(1); columns++)
{
Console.Write(myArray[rows, columns] + "\t");
}
Console.WriteLine();
}
}
}
}
// for (int k = 0; k < daysInAMonth.Length; k++)
// {
// Console.WriteLine(daysInAMonth[k]);
// }
// if (monthsofAyear[i] == "February")
// {
// for (int d = 0; d < 28; d++)
// {
// Console.WriteLine(daysInAMonth[d]);
// }
// }
// else if (monthsofAyear[i] == "April" || monthsofAyear[i] == "June" || monthsofAyear[i] == "September" || monthsofAyear[i] == "November")
// {
// for (int m = 0; m < 30; m++)
// {
// Console.WriteLine(daysInAMonth[m]);
// }
// }
// else
// {
// for (int e = 0; e < 31; e++)
// {
// Console.WriteLine(daysInAMonth[e]);
// }
// }
//}
//foreach (string day in monthsofAyear)
//{
// Console.WriteLine(day);
//}