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 Projekt_1
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (V.run == 1)
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" 1. Sälja literatur");
- Console.WriteLine(" 2. Köpa literatur");
- Console.WriteLine(" 3. Anslagstavlan \n");
- Console.WriteLine(" 4. Stäng programmet");
- while (!V.validInput)
- {
- V.val = Console.ReadLine();
- if (!UInt32.TryParse(V.val, out V.valOk))
- {
- Console.WriteLine("Fel inmatning!");
- }
- else if (V.valOk.Equals(0))
- {
- Console.WriteLine("Inmatat värde måste vara högre än noll.");
- }
- else
- {
- break;
- }
- }
- switch (V.val)
- {
- case "1":
- // Annonshantering
- Console.Clear(); //rensa tidigare utseende
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" 1. Lägga till annons");
- Console.WriteLine(" 2. Ta bort annons");
- while (!V.validInput)
- {
- V.annonsVal = Console.ReadLine();
- if (!UInt32.TryParse(V.annonsVal, out V.valOk))
- {
- Console.WriteLine("Fel inmatning!");
- }
- else if (V.valOk.Equals(0))
- {
- Console.WriteLine("Inmatat värde måste vara högre än noll.");
- }
- else
- {
- break;
- }
- }
- switch (V.annonsVal)
- {
- case "1":
- Console.Clear();//rensa tidigare utseende
- while (V.slut == "1")
- {
- for (V.i = 0; V.slut == "1"; V.i++)
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________");
- Console.WriteLine("");
- Console.WriteLine(" Dina uppgifter");
- Console.Write(" Namn: ");
- V.name[V.i] = Console.ReadLine(); //lägger namn till vektor "name"
- Console.Write(" Boktitel: ");
- V.bokId[V.i] = Console.ReadLine();//lägger boknamn till vektor "bokId"
- Console.Write(" Telefonnummer: ");
- V.tele[V.i] = Console.ReadLine();//lägger telefonnummer till vektor "tele"
- Console.Write(" Kostnad: ");
- V.money[V.i] = Console.ReadLine();//lägger beloppet till vektor "money"
- Console.Write(" Beskrivning: ");
- V.note[V.i] = Console.ReadLine();//lägger beskrivning för bok till vektor "note"
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" Din annons ligger nu uppe! "); //skapa en summa summarum av order info
- Console.WriteLine(" ");
- V.antal++;
- Console.WriteLine(" Vill du göra en ny annons?\n");
- Console.WriteLine(" 1. Ja");
- Console.WriteLine(" 2. Nej");
- while (!V.validInput)
- {
- V.slut = Console.ReadLine();
- if (!UInt32.TryParse(V.slut, out V.valOk))
- {
- Console.WriteLine("Fel inmatning!");
- }
- else if (V.valOk.Equals(0))
- {
- Console.WriteLine("Inmatat värde måste vara högre än noll.");
- }
- else
- {
- break;
- }
- }
- Console.Clear();
- }
- }
- break;
- case "2":
- // ta bort kod
- Console.Clear();
- break;
- }
- break;
- case "2": // Köp litteratur
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" Lista över tillgänglig literatur.");
- for (V.i = 0; V.i < V.antal; V.i++)
- {
- Console.WriteLine("");
- Console.WriteLine("------------------------------------------");
- Console.WriteLine("");
- Console.WriteLine(" Titel: " + V.bokId[V.i]);
- Console.WriteLine(" Beskrivning: " + V.note[V.i]);
- Console.WriteLine(" Pris: " + V.money[V.i]);
- Console.WriteLine(" Kontakt: " + V.name[V.i] + ", " + V.tele[V.i]);
- }
- Console.WriteLine("\n Tryck valfri knapp för att gå till meny. ");
- Console.ReadKey();
- Console.Clear();
- break;
- case "3": // Anslagstavlan
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________ \n");
- Console.WriteLine(" Välkommen till anslagstavlan!");
- Console.WriteLine(" 1. Skapa inlägg.");
- Console.WriteLine(" 2. Läs inlägg");
- while (!V.validInput)
- {
- V.anslagVal = Console.ReadLine();
- if (!UInt32.TryParse(V.anslagVal, out V.valOk))
- {
- Console.WriteLine("Fel inmatning!");
- }
- else if (V.valOk.Equals(0))
- {
- Console.WriteLine("Inmatat värde måste vara högre än noll.");
- }
- else
- {
- break;
- }
- }
- Console.Clear();
- switch (V.anslagVal)
- {
- case "1":
- while (V.anslagSlut == 1)
- {
- for (V.i = 0; V.anslagSlut == 1; V.i++)
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.Write(" Ditt namn, telefonnummer: ");
- V.anslagNamn[V.i] = Console.ReadLine();
- Console.Write(" Meddelande: ");
- V.anslagMedd[V.i] = Console.ReadLine();
- V.anslagAntal++;
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" Vill du göra ett nytt inlägg?");
- Console.WriteLine(" 1. Ja");
- Console.WriteLine(" 2. Nej");
- V.anslagSlut = int.Parse(Console.ReadLine());
- Console.Clear();
- }
- }
- break;
- case "2":
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Console.Write("{0, -10}" + "Lit", "");
- Console.ResetColor();
- Console.WriteLine("Bay v1.0");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" Lista över inlägg.");
- for (V.i = 0; V.i < V.anslagAntal; V.i++)
- {
- Console.WriteLine("");
- Console.WriteLine("________________________________\n");
- Console.WriteLine(" Skribent: " + V.anslagNamn[V.i]);
- Console.WriteLine(" Meddelande: " + V.anslagMedd[V.i]);
- }
- Console.WriteLine("\n Tryck valfri knapp för att gå tillbaka till menyn. \n ");
- Console.ReadKey();
- Console.Clear();
- break;
- }
- break;
- case "4":
- Console.Clear();
- V.run = 2;
- break;
- case "5":
- Console.WriteLine(". .,,*%#, ");
- Console.WriteLine(" ,(( ############### ");
- Console.WriteLine(" ############/ ###################( ");
- Console.WriteLine(" .%###%/ (###############* %##%. ####################### ");
- Console.WriteLine(" ########## *#.%* .################# .############* .########################## ");
- Console.WriteLine(" #############.#/ *##. ###### (###### ################## .####################### *#. ");
- Console.WriteLine(" ###########(.#*###((### ### ### *## / .############### ######## .####(* ## ");
- Console.WriteLine(" /#########(#####*#########. ### ## # #######/ ###### ### ## ");
- Console.WriteLine(" #%##* ########### ##( (# #. (##### (#######%( /###### ");
- Console.WriteLine(" ### ######### ##. . # ## ##### ############# (#####(. ##### ");
- Console.WriteLine(" (# ######## /## ######## ####### #, ##, .#### ############# ######### ##### ");
- Console.WriteLine(" ## .* ####### ## ########( ####### # ###########,*(########/,### ### *#### *#(. #### ");
- Console.WriteLine(" ## ######## *####### *###### #( / * #################### .*## ### ###( ");
- Console.WriteLine(" *# ######## /##### ###### / * #########* .###*/ ( (## ## .### ");
- Console.WriteLine(" # # #### # /######### ,#,## ,, , ############ ( # ## ");
- Console.WriteLine(" / # * ## # ############# /## . , ############## (## ## ");
- Console.WriteLine(" ########### # # #/*### .#(###### # #########,##( ################### #( ");
- Console.WriteLine(" ###########/ ,##/# # .####., ############### ##### ##########%* #/###( ");
- Console.WriteLine(" ###########/# (###* ### #### ######################### ,###########/ *####( ");
- Console.WriteLine(" *###########/ ##### ###* , # ################ ######### ###, ############ #### ## ");
- Console.WriteLine(" ,######## (#### ############## ###########.######%. ########### %####################### ## ");
- Console.WriteLine(" ################. (########## * ############.* , ##################################( ### ");
- Console.WriteLine(" * ################ #. ### ######### ############# ################################### , #### ");
- Console.WriteLine(" .##################### #### ######## /######## ############################################################ ##### ");
- Console.WriteLine(" #########################, ###################(######## ##/########################################################################( ");
- Console.WriteLine(" #############################/ .############################ ################################################################# ###########");
- Console.WriteLine("############################### ############################### /######################################################(# ./ #############");
- Console.WriteLine("#################################################################### ######################################################## /################");
- Console.WriteLine("###############################################################################################################################################################");
- Console.WriteLine("############( ############# ### .####################### /######################################### ## ############################# ############");
- Console.WriteLine("########### ### ####* ### # .* ####, ### # ### / .##. ## ,# * ## # ### ####### ###### ## # #### .#### ##. ###########");
- Console.WriteLine("########### ## ## ## ## %## # #. ## # #, ## # #. ## ,# #(# # #* ########## ,## ## # # ## # ######. ############");
- Console.WriteLine("########### #### #. ## ## ### .#/ # ###### ## ## .#( #. ## ,# ### *#, ####* ###### ###### ## ## # ########( #. ############");
- Console.WriteLine("############# #### ### # .#/ ##/ ## ## ## # ### ,# #### # ## .###### ###### ## ## ## .## ### (##########");
- Console.WriteLine("##################################################################################### ###################################################################");
- Console.WriteLine("###############################################################################################################################################################");
- Console.WriteLine("###############################################################################################################################################################");
- Console.ReadKey();
- break;
- }
- }
- }
- }
- }
- namespace Projekt_1
- {
- internal class V
- {
- public static bool validInput = false;
- public static uint valOk = 0;
- public static int anslagSlut = 1;
- public static int anslagAntal = 0;
- public static int antal = 0;
- public static int run = 1;
- public static string slut = "1";
- public static string val = "0";
- public static string annonsVal = "0";
- public static int köpVal = 0;
- public static string anslagVal = "0";
- public static int i = 0;
- public static string[] bokId = new string[10];
- public static string[] tele = new string[10];
- public static string[] name = new string[10];
- public static string[] note = new string[10];
- public static string[] money = new string[10];
- public static string[] anslagNamn = new string[10];
- public static string[] anslagMedd = new string[10];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement