-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
29 lines (28 loc) · 1.01 KB
/
Program.cs
File metadata and controls
29 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Text.RegularExpressions;
namespace StudyProject
{
class Program
{
static void Main(string[] args)
{
//Первое задание
string Date = DateTime.Now.Date.ToShortDateString();
string str = "Привет, " + Environment.UserName + "\nСегодня " + Date;
Console.WriteLine(str);
Console.WriteLine("Если это то, что было нужно нажмите Enter, иначе любую другую");
bool flag = Console.ReadKey().Key == ConsoleKey.Enter;
if (flag)
{
Environment.Exit(0);
}
Console.Clear();
Console.WriteLine("Ведите Имя, используйте только буквы, цифры показаны не будут!");
string name = Console.ReadLine();
string UserName = Regex.Replace(name, "[^a-zA-ZА-Яа-я]", "");
Console.WriteLine("Привет, " + UserName + "\nСегодня " + Date);
Console.WriteLine("Для выхода нажмите любую клавишу");
Console.ReadKey();
}
}
}