Skip to content

Instantly share code, notes, and snippets.

@dretax
Last active September 29, 2016 10:22
Show Gist options
  • Save dretax/900bf5a95f974114fe3ab400253e60b0 to your computer and use it in GitHub Desktop.
Save dretax/900bf5a95f974114fe3ab400253e60b0 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IziProgZH2
{
internal class Program
{
internal const string cuser = "gipszjakab";
internal const string cpasswd = "alma";
internal static void Main(string[] args)
{
string user = "";
string pw = "";
string pick = "";
Console.WriteLine("Login with ur username/password");
Console.WriteLine("User: ");
user = Console.ReadLine();
Console.WriteLine("Pw: ");
pw = Console.ReadLine();
while (user.ToLower() != cuser && pw.ToLower() != cpasswd)
{
Console.WriteLine("Invalid login data!");
Console.WriteLine("User: ");
user = Console.ReadLine();
Console.WriteLine("Password: ");
pw = Console.ReadLine();
}
Console.WriteLine("Successfully logged in! Type kör or négyzet");
pick = Console.ReadLine();
while (pick.ToLower() != "kör" && pick.ToLower() != "négyzet")
{
Console.WriteLine("Invalidpick!");
Console.WriteLine("Type 'kör' or 'négyzet'");
pick = Console.ReadLine();
}
string svalue;
double dv;
if (pick == "kör")
{
Console.WriteLine("Type the desired r to calculate with:");
svalue = Console.ReadLine();
bool b = double.TryParse(svalue, out dv);
while (!b)
{
Console.WriteLine("Type the desired r to calculate with:");
svalue = Console.ReadLine();
b = double.TryParse(svalue, out dv);
}
Console.WriteLine("Calc: " + 3.14 * dv*dv);
}
else
{
Console.WriteLine("Type the desired a to calculate square's T with:");
svalue = Console.ReadLine();
bool b = double.TryParse(svalue, out dv);
while (!b)
{
Console.WriteLine("Type the desired r to calculate with:");
svalue = Console.ReadLine();
b = double.TryParse(svalue, out dv);
}
Console.WriteLine("Calc: " + dv*dv);
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment