Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
TempConverter
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); //Your code goes here Console.WriteLine("Hello, world!"); Fahrenheit f = new Fahrenheit(108.0f); Console.Write("{0} fahrenheit", f.Degrees); Celsius c = (Celsius)f; Console.Write(" = {0} celsius", c.Degrees); Fahrenheit f2 = (Fahrenheit)c; Console.WriteLine(" = {0} fahrenheit", f2.Degrees); } } class Celsius { public Celsius(float temp) { degrees = temp; } public static explicit operator Fahrenheit(Celsius c) { return new Fahrenheit((9.0f / 5.0f) * c.degrees + 32); } public float Degrees { get { return degrees; } } private float degrees; } class Fahrenheit { public Fahrenheit(float temp) { degrees = temp; } // Must be defined inside a class called Farenheit: public static explicit operator Celsius(Fahrenheit f) { return new Celsius((5.0f / 9.0f) * (f.degrees - 32)); } public float Degrees { get { return degrees; } } private float degrees; } }
run
|
edit
|
history
|
help
0
MyGenerics
Ty
Dotnet Q-3
Events
lit pe
Sort example
Ftg
Polygon Util
work_laba#2
Computing Time Zone Different