Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //Maixior:D
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- double temp;
- double temp1;
- int chose;
- string restart;
- Start:
- Console.Clear();
- Console.Write("Witaj w przeliczniku temperatury \n");
- Console.Write("Wybierz jak chcesz przeliczac: \n 1. Zamien °C \n 2. Zamien K \n 3. Zamien °F \n 4. Chce wyjsc \n");
- Chose:
- chose = Convert.ToInt32(Console.ReadLine());
- switch(chose) {
- case 1:
- Console.Write("podaj °C: "); temp = Convert.ToDouble(Console.ReadLine());
- temp1 = temp + 273.15;
- Console.Write("tempertra w K: " + temp1 + "\n");
- temp1 = (temp * 1.8) + 32;
- Console.Write("tempertra w °F: " + temp1 + "\n");
- break;
- case 2:
- Console.Write("podaj K: "); temp = Convert.ToDouble(Console.ReadLine());
- temp1 = temp - 273.15;
- Console.Write("tempertra w °C: " + temp1 + "\n");
- temp1 = (temp * 1.8) - 459.67;
- Console.Write("tempertra w °F: " + temp1 + "\n");
- break;
- case 3:
- Console.Write("podaj °F: "); temp = Convert.ToDouble(Console.ReadLine());
- temp1 = (temp - 32) / 1.8;
- Console.Write("tempertra w °C: " + temp1 + "\n");
- temp1 = (temp + 459.67) * 5/9;
- Console.Write("tempertra w K: " + temp1 + "\n");
- break;
- case 4:
- Environment.Exit(1);
- break;
- default:
- Console.Write("Zly wybor, sproboj jeszcze raz \n");
- goto Chose;
- }
- End:
- Console.Write("jeszcze raz? y/n \n");
- restart = Console.ReadLine();
- if (restart == "y" || restart == "Y") {
- goto Start;
- } else if (restart == "n" || restart == "N") {
- Environment.Exit(1);
- } else {
- Console.Write("Zly wybor, sproboj jeszcze raz \n");
- goto End;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment