Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Diagnostics;
  7.  
  8. namespace Programmet_Hovedmenuen
  9. {
  10.     class Hovedmenu
  11.     {
  12.         public void hovedskærmen()
  13.         {
  14.             int tal;
  15.  
  16.             int screenwidth = 150;
  17.             int screenheight = 50;
  18.             Console.SetWindowSize(screenwidth, screenheight);
  19.  
  20.             //do
  21.  
  22.             //{
  23.             Console.Clear();
  24.  
  25.  
  26.             Console.SetCursorPosition(100, 2);
  27.             Console.WriteLine("Dato: {0}", DateTime.Now); //udskrives dato og tid
  28.  
  29.             Console.BackgroundColor = ConsoleColor.Yellow;
  30.             Console.ForegroundColor = ConsoleColor.DarkMagenta;
  31.  
  32.             Console.SetCursorPosition(25, 5);
  33.             Console.WriteLine(" <<< H O V E D M E N U E N >>> ");
  34.             Console.ResetColor();
  35.  
  36.             Console.SetCursorPosition(75, 5);
  37.             Console.WriteLine("Tryk [Q] Afslut");
  38.  
  39.             Console.BackgroundColor = ConsoleColor.White;
  40.             Console.BackgroundColor = ConsoleColor.White;
  41.             Console.ForegroundColor = ConsoleColor.DarkBlue;
  42.  
  43.             Console.SetCursorPosition(25, 7);
  44.             Console.WriteLine(" VÆLGE EN EMNE ");
  45.             Console.ResetColor();
  46.  
  47.             Console.SetCursorPosition(25, 9);
  48.             Console.WriteLine("1. Variabler ");
  49.  
  50.             Console.SetCursorPosition(25, 10);
  51.             Console.WriteLine("2. Strings ");
  52.  
  53.             Console.SetCursorPosition(25, 11);
  54.             Console.WriteLine("3. Airthmetiske udtryk");
  55.  
  56.             Console.SetCursorPosition(25, 12);
  57.             Console.WriteLine("4. Variabler i udtryk");
  58.  
  59.             Console.SetCursorPosition(25, 13);
  60.             Console.WriteLine("5. Boolske variable");
  61.  
  62.             Console.SetCursorPosition(25, 14);
  63.             Console.WriteLine("6. If-else statements");
  64.  
  65.             Console.SetCursorPosition(25, 15);
  66.             Console.WriteLine("7. Switch Case");
  67.  
  68.             Console.SetCursorPosition(25, 16);
  69.             Console.WriteLine("8. Loops");
  70.  
  71.             Console.SetCursorPosition(55, 9);
  72.             Console.WriteLine("9. Udvidet kontrolstrukturer");
  73.  
  74.             Console.SetCursorPosition(55, 10);
  75.             Console.WriteLine("10. Metoder og instanser");
  76.  
  77.             Console.SetCursorPosition(55, 11);
  78.             Console.WriteLine("11. Returtyper og parametre");
  79.  
  80.             Console.SetCursorPosition(55, 12);
  81.             Console.WriteLine("12. Instancevariabler");
  82.  
  83.             Console.SetCursorPosition(55, 13);
  84.             Console.WriteLine("13. Nedarvning");
  85.  
  86.             Console.SetCursorPosition(55, 14);
  87.             Console.WriteLine("14. Konstruktors");
  88.  
  89.             Console.SetCursorPosition(55, 15);
  90.             Console.WriteLine("15. Arrays");
  91.  
  92.             Console.SetCursorPosition(55, 16);
  93.             Console.WriteLine("16. Gennemløb af arrays");
  94.  
  95.             Console.SetCursorPosition(25, 20);
  96.             Console.WriteLine("Indtast tal(1-16) for at vælge Emne: ");
  97.  
  98.             Console.SetCursorPosition(62, 20);
  99.             tal = Convert.ToInt32(Console.ReadLine());
  100.  
  101.  
  102.             if (tal < 1 && tal > 16)
  103.                 Console.WriteLine("Fejl!!! Indtast igen!");
  104.  
  105.             switch (tal)
  106.             {
  107.  
  108.                 case 1:
  109.                     variabel();
  110.                     break;
  111.                 case 2:
  112.                     break;
  113.  
  114.                    
  115.  
  116.             }
  117.         }
  118.  
  119.         public void variabel()
  120.         {
  121.             string valg;
  122.             Console.Clear();
  123.  
  124.             Console.BackgroundColor = ConsoleColor.Yellow;
  125.             Console.ForegroundColor = ConsoleColor.Blue;
  126.  
  127.  
  128.             Console.SetCursorPosition(25, 5);
  129.             Console.WriteLine(" <<< V A R I A B L E R >>> ");
  130.             Console.ResetColor();
  131.  
  132.                        
  133.             Console.SetCursorPosition(25, 7);
  134.             Console.WriteLine("1. Opgave1 & 2");
  135.  
  136.             Console.SetCursorPosition(25, 8);
  137.             Console.WriteLine("2. Opgave 3");
  138.  
  139.             Console.SetCursorPosition(25, 9);
  140.             Console.WriteLine("3. Opgave 4");
  141.  
  142.             Console.SetCursorPosition(25, 10);
  143.             Console.WriteLine("4. Opgave 5");
  144.  
  145.             Console.SetCursorPosition(25, 11);
  146.             Console.WriteLine("5. Opgave 6");
  147.  
  148.             Console.SetCursorPosition(25, 13);
  149.             Console.WriteLine("Indtast [H]- at gå til Hovedmenuen Og Indtast[1 - 6] - at vælge opgaver:");
  150.                        
  151.             Console.SetCursorPosition(98, 13);
  152.             valg = Console.ReadLine().ToLower();
  153.  
  154.             switch (valg)
  155.  
  156.             {
  157.                 case "1":
  158.                     Process.Start(@"C:\Users\Rizmu\source\repos\Opgave1,2 variabler\ConsoleApp1.sln");  //linking til program opgave 1 og 2 variabel
  159.                    hovedskærmen();
  160.                  
  161.  
  162.                     break;
  163.  
  164.                 case "h":
  165.  
  166.                     hovedskærmen();
  167.                     break;
  168.  
  169.             }
  170.                  
  171.  
  172.         }
  173.  
  174.                         //*********************Hoved Programmet********************************
  175.  
  176.         class Program
  177.         {
  178.  
  179.             static void Main(string[] args)
  180.             {
  181.  
  182.              
  183.                 Hovedmenu h = new Hovedmenu();
  184.                 h.hovedskærmen();
  185.                                                                                                                                      
  186.  
  187.                 Console.ReadKey();
  188.  
  189.  
  190.  
  191.                
  192.             }
  193.         }
  194.     }
  195. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement