two left
This commit is contained in:
39
labs/lab2_done/EnglishDist/Program.cs
Normal file
39
labs/lab2_done/EnglishDist/Program.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
struct Distance
|
||||
{
|
||||
public int feet;
|
||||
public int inches;
|
||||
|
||||
public void Print()
|
||||
{
|
||||
Console.WriteLine("{0}' - {1}''", feet, inches);
|
||||
}
|
||||
}
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Distance d1, d2, d3;
|
||||
|
||||
Console.Write("Input the first distance (feet): ");
|
||||
d1.feet = int.Parse(Console.ReadLine());
|
||||
Console.Write("Input the first distance (inches): ");
|
||||
d1.inches = int.Parse(Console.ReadLine());
|
||||
|
||||
Console.Write("Input the second distance (feet): ");
|
||||
d2.feet = int.Parse(Console.ReadLine());
|
||||
Console.Write("Input the second distance (inches): ");
|
||||
d2.inches = int.Parse(Console.ReadLine());
|
||||
|
||||
d3.feet = d1.feet + d2.feet;
|
||||
d3.inches = d1.inches + d2.inches;
|
||||
|
||||
d3.feet += d3.inches % 12;
|
||||
d3.inches = d3.inches / 12;
|
||||
|
||||
d3.Print();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user