first ex
This commit is contained in:
@@ -4,7 +4,11 @@
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
SplitNumber a = new SplitNumber();
|
||||
a.Value = 1.54;
|
||||
|
||||
Console.WriteLine(a.First);
|
||||
Console.WriteLine(a.Second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
33
first/SplitNumber.cs
Normal file
33
first/SplitNumber.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace first
|
||||
{
|
||||
public class SplitNumber
|
||||
{
|
||||
public double First
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public double Second
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public double Value
|
||||
{
|
||||
get { return First + Second; }
|
||||
set
|
||||
{
|
||||
First = Math.Truncate(value);
|
||||
Second = value - First;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user