From 1b1162c5ca8a2d7d446c4f3cfcd00747958d972e Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 16:01:45 +0700 Subject: [PATCH 1/5] Add: program basic part. 1 --- Program.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index fd851a1..034bbd9 100644 --- a/Program.cs +++ b/Program.cs @@ -4,10 +4,15 @@ class Program { static void Main() { + // Output to console basic text Console.WriteLine("Hello World!"); - // See https://aka.ms/new-console-template for more information - Console.WriteLine("Hello, World!"); - var name = Console.ReadLine(); + + // Output get datetime to console Console.WriteLine("Date now: " + DateTime.Now); + + // Input from user + var name = Console.ReadLine(); + // Output to console + Console.WriteLine("Hi, " + name); } } \ No newline at end of file From bc78c3ed149245b7053092e6433907d152808a50 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 16:31:37 +0700 Subject: [PATCH 2/5] Update: program, modify output --- Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Program.cs b/Program.cs index 034bbd9..e368e44 100644 --- a/Program.cs +++ b/Program.cs @@ -11,6 +11,7 @@ static void Main() Console.WriteLine("Date now: " + DateTime.Now); // Input from user + Console.Write("Type your name: "); var name = Console.ReadLine(); // Output to console Console.WriteLine("Hi, " + name); From 3fb9e1baff392982c18803a2e0dcfaa32bdcf893 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 17:08:19 +0700 Subject: [PATCH 3/5] Update: program.cs add function to call in Main --- Program.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index e368e44..60c0e2c 100644 --- a/Program.cs +++ b/Program.cs @@ -5,15 +5,27 @@ class Program static void Main() { // Output to console basic text - Console.WriteLine("Hello World!"); + // Console.WriteLine(TextHello()); // Output get datetime to console - Console.WriteLine("Date now: " + DateTime.Now); + // Console.WriteLine(GetDateSystem()); // Input from user + Console.WriteLine(InputFromUser()); + } + + static String TextHello() { + return "Hello World!"; + } + + static String GetDateSystem() { + DateTime getDateBySystem = DateTime.Now; + return "Date now: " + getDateBySystem; + } + + static String InputFromUser() { Console.Write("Type your name: "); var name = Console.ReadLine(); - // Output to console - Console.WriteLine("Hi, " + name); + return "Hi, " + name; } } \ No newline at end of file From 6e44086a80d15224eaab9e88716a755bdff04917 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 17:08:27 +0700 Subject: [PATCH 4/5] Add: README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2d1b46 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +## Project Base Learn .NET Console +Project console .NET basic from 0 to hero + +## a. Get Date by System + +```.cs +Console.WriteLine("Date now: " + DateTime.Now); +``` + +## b. Type Input & Show to Output + +```.cs +Console.Write("Type your name: "); +var name = Console.ReadLine(); +Console.WriteLine("Hi, " + name); +``` \ No newline at end of file From 50f5b6312b9d21fbab49d4039f3d1bc251fabd8e Mon Sep 17 00:00:00 2001 From: Asep Septiadi <98740335+aspsptyd@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:11:01 +0700 Subject: [PATCH 5/5] Update: add output terminal console --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2d1b46..7802eac 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,19 @@ Project console .NET basic from 0 to hero ## a. Get Date by System ```.cs -Console.WriteLine("Date now: " + DateTime.Now); +DateTime getDateBySystem = DateTime.Now; +return "Date now: " + getDateBySystem; ``` +![Screenshot 2025-02-10 at 17 07 25](https://github.com/user-attachments/assets/65df1e27-62a9-4155-956c-a19cb11d0d34) + + ## b. Type Input & Show to Output ```.cs Console.Write("Type your name: "); var name = Console.ReadLine(); -Console.WriteLine("Hi, " + name); -``` \ No newline at end of file +return "Hi, " + name; +``` + +![Screenshot 2025-02-10 at 17 09 49](https://github.com/user-attachments/assets/a9547da4-d992-42e3-b506-32c4892fd365)