using System;
using System.Collections.Generic;
using System.Text;
namespace practice
{
class Program
{
static void Main(string[] args)
{
string choice;
double C;
double a = 0.55555555555555555555555555555556;
double F;
bool repeat = false;
do
{
Console.WriteLine("Menu:");
Console.WriteLine("[C] Convert from Fahrenheit to Celsius");
Console.WriteLine("[F] Convert from Celsius to Fahrenheit");
Console.WriteLine("[X] Exit application");
Console.Write("Choice: "); repeat = false;
choice = Console.ReadLine();
switch (choice)
{
case "c":
case "C":
{
Console.Write("Enter temperature in Fahrenheit: ");
choice = Console.ReadLine();
if (choice == "")
{
repeat = true; break;
}
else
{
F = double.Parse(choice);
C = ((F - 32) * a);
Console.WriteLine("Temperature in Celcius: " + C);
repeat = true; break;
}
}
case "f":
case "F":
{
Console.Write("Enter temperature in Celsius: ");
choice = Console.ReadLine();
if (choice == "")
{
repeat = true; break;
}
else
{
C = double.Parse(choice);
F = (1.8) * C + 32;
Console.WriteLine("Temperature in Fahrenheit: " + F);
repeat = true; break;
}
}
case "x":
case "X":
{
Console.WriteLine("BABAY!!!"); break;
}
default:
{
Console.WriteLine("Error"); Console.ReadLine();
repeat = true; break;
}
}
} while (repeat == true);
}
}
}
Sunday, July 22, 2007
[Answer]Problem #2 EXAM dotnetstarter.blogspot.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment