Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace My_first_project
- {
- class Program
- {
- static void Main(string[] args)
- {
- calculator();
- }
- private static void calculator()
- {
- userStart:
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Write("User : ");
- String user = Console.ReadLine();
- if (user == "raxemodz")
- {
- passwordStart:
- Console.Write("Password : ");
- String password = Console.ReadLine();
- if (password == "hatemyself")
- {
- mainStart:
- Console.Clear();
- Console.WriteLine("Hello, " + user + " and welcome to my first calculator programmed in C#.");
- Console.WriteLine("----------------------------------------------------------------------------");
- Console.WriteLine("1. Division\n2. Multiplication\n3. Addition\n4. Substraction");
- Console.Write("Choise : ");
- String choise = Console.ReadLine();
- if (choise == "1")
- {
- divisionStart:
- double firstNumber;
- double secondNumbers;
- Console.Clear();
- Console.WriteLine("-----------------------------");
- Console.Write("First number : ");
- firstNumber = Convert.ToDouble(Console.ReadLine());
- Console.Write("Second numbers : ");
- secondNumbers = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Result : " + firstNumber / secondNumbers);
- Console.WriteLine("-----------------------------");
- Console.ReadKey();
- Console.ReadLine();
- goto divisionStart;
- }
- else if (choise == "2")
- {
- multiplicationStart:
- int firstNumber;
- int secondNumbers;
- Console.Clear();
- Console.WriteLine("-----------------------------");
- Console.Write("First number : ");
- firstNumber = Convert.ToInt32(Console.ReadLine());
- Console.Write("Second numbers : ");
- secondNumbers = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Result : " + firstNumber * secondNumbers);
- Console.WriteLine("-----------------------------");
- Console.ReadKey();
- Console.ReadLine();
- goto multiplicationStart;
- }
- else if (choise == "3")
- {
- additionStart:
- int firstNumber;
- int secondNumber;
- Console.Clear();
- Console.WriteLine("-----------------------------");
- Console.Write("First number : ");
- firstNumber = Convert.ToInt32(Console.ReadLine());
- Console.Write("Second number : ");
- secondNumber = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Result : " + (firstNumber + secondNumber));
- Console.WriteLine("-----------------------------");
- Console.ReadKey();
- Console.ReadLine();
- goto additionStart;
- }
- else if (choise == "4")
- {
- substractionStart:
- int firstNumber;
- int secondNumber;
- Console.Clear();
- Console.WriteLine("-----------------------------");
- Console.Write("First number : ");
- firstNumber = Convert.ToInt32(Console.ReadLine());
- Console.Write("Second number : ");
- secondNumber = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Result : " + (firstNumber - secondNumber));
- Console.WriteLine("-----------------------------");
- Console.ReadKey();
- Console.ReadLine();
- goto substractionStart;
- }
- else
- {
- Console.WriteLine("Wrong value please try again :/");
- Console.ReadKey();
- Console.ReadLine();
- goto mainStart;
- }
- }
- else
- {
- Console.Clear();
- Console.WriteLine("You enter the wrong password please try again :/");
- Console.ReadKey();
- Console.ReadLine();
- goto passwordStart;
- }
- }
- else
- {
- Console.Clear();
- Console.WriteLine("You enter the wrong user please try again :/");
- Console.ReadKey();
- Console.ReadLine();
- goto userStart;
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement