Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleColorProject
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine();
- Start();
- }
- static void Calculator()
- {
- string str;
- double firstNum;
- double secNum;
- char op;
- do
- {
- Console.WriteLine();
- Console.Write("First number: ");
- str = Console.ReadLine();
- if (str == "exit")
- {
- Console.WriteLine();
- Start();
- }
- firstNum = Convert.ToDouble(str);
- Console.Write("Operator: ");
- op = Convert.ToChar(Console.ReadLine());
- Console.Write("Second number: ");
- secNum = Convert.ToDouble(Console.ReadLine());
- double erg1 = firstNum + secNum;
- double erg2 = firstNum - secNum;
- double erg3 = firstNum * secNum;
- double erg4 = firstNum / secNum;
- switch (op)
- {
- case '+': Console.WriteLine(erg1); break;
- case '-': Console.WriteLine(erg2); break;
- case '*': Console.WriteLine(erg3); break;
- case '/': Console.WriteLine(erg4); break;
- }
- Console.WriteLine();
- } while (true);
- }
- static void Start()
- {
- Console.WriteLine("(Type in the number and press ENTER to select. Type in 'exit' after 'First Number' comes up to go back to the menu.)");
- Console.WriteLine("1) Background color");
- Console.WriteLine("2) Font color");
- Console.WriteLine("3) Start program");
- int x = Convert.ToInt32(Console.ReadLine());
- switch (x)
- {
- case 1: ConsoleBG(); break;
- case 2: ConsoleFG(); break;
- case 3: Calculator(); break;
- }
- Start();
- }
- static void ConsoleBG()
- {
- Console.WriteLine();
- Console.WriteLine("1) green, "+"2) yellow, "+"3) red, "+"4) darkblue, "+"5) back");
- int x = Convert.ToInt32(Console.ReadLine());
- switch (x)
- {
- case 1: Console.BackgroundColor = ConsoleColor.Green; break;
- case 2: Console.BackgroundColor = ConsoleColor.Yellow; break;
- case 3: Console.BackgroundColor = ConsoleColor.Red; break;
- case 4: Console.BackgroundColor = ConsoleColor.DarkBlue; break;
- case 5: Start(); break;
- }
- Console.Clear();
- Start();
- }
- static void ConsoleFG()
- {
- Console.WriteLine();
- Console.WriteLine("1) white, "+"2) black, "+"3) blue, "+"4) back");
- int x = Convert.ToInt32(Console.ReadLine());
- switch (x)
- {
- case 1: Console.ForegroundColor = ConsoleColor.White; break;
- case 2: Console.ForegroundColor = ConsoleColor.Black; break;
- case 3: Console.ForegroundColor = ConsoleColor.Blue; break;
- case 4: Start(); break;
- }
- Console.WriteLine();
- Start();
- }
- }
- }
Add Comment
Please, Sign In to add comment