-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExStructures2.cs
41 lines (38 loc) · 996 Bytes
/
ExStructures2.cs
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
30
31
32
33
34
35
36
37
38
39
40
41
using Logique;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace exercices
{
public class ExStructures2 : iCommand
{
public string Name => "02_ExStructures";
public void Execute()
{
Celsius c;
Fahrenheit f;
c.Temperature = 90;
f.Temperature = 50;
Console.WriteLine($"{c.Temperature}°C fait {c.ToFahrenheit()}°F");
Console.WriteLine($"{f.Temperature}°C fait {f.ToCelsius()}°F");
}
public struct Celsius
{
public double Temperature;
public double ToFahrenheit()
{
return (Temperature*1.8)+32;
}
}
public struct Fahrenheit
{
public double Temperature;
public double ToCelsius()
{
return (Temperature - 32) / 1.8;
}
}
}
}