Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.70 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.  
  7. namespace Projekt_1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. while (V.run == 1)
  15. {
  16. Console.Clear();
  17. Console.ForegroundColor = ConsoleColor.DarkGray;
  18. Console.Write("{0, -10}" + "Lit", "");
  19. Console.ResetColor();
  20. Console.WriteLine("Bay v1.0");
  21. Console.WriteLine("________________________________\n");
  22. Console.WriteLine(" 1. Sälja literatur");
  23. Console.WriteLine(" 2. Köpa literatur");
  24. Console.WriteLine(" 3. Anslagstavlan \n");
  25. Console.WriteLine(" 4. Stäng programmet");
  26. while (!V.validInput)
  27. {
  28. V.val = Console.ReadLine();
  29. if (!UInt32.TryParse(V.val, out V.valOk))
  30. {
  31. Console.WriteLine("Fel inmatning!");
  32. }
  33. else if (V.valOk.Equals(0))
  34. {
  35. Console.WriteLine("Inmatat värde måste vara högre än noll.");
  36. }
  37. else
  38. {
  39. break;
  40. }
  41.  
  42.  
  43. }
  44. switch (V.val)
  45. {
  46.  
  47. case "1":
  48. // Annonshantering
  49. Console.Clear(); //rensa tidigare utseende
  50. Console.ForegroundColor = ConsoleColor.DarkGray;
  51. Console.Write("{0, -10}" + "Lit", "");
  52. Console.ResetColor();
  53. Console.WriteLine("Bay v1.0");
  54. Console.WriteLine("________________________________\n");
  55. Console.WriteLine(" 1. Lägga till annons");
  56. Console.WriteLine(" 2. Ta bort annons");
  57.  
  58. while (!V.validInput)
  59. {
  60. V.annonsVal = Console.ReadLine();
  61. if (!UInt32.TryParse(V.annonsVal, out V.valOk))
  62. {
  63. Console.WriteLine("Fel inmatning!");
  64. }
  65. else if (V.valOk.Equals(0))
  66. {
  67. Console.WriteLine("Inmatat värde måste vara högre än noll.");
  68. }
  69. else
  70. {
  71. break;
  72. }
  73.  
  74.  
  75. }
  76. switch (V.annonsVal)
  77. {
  78. case "1":
  79. Console.Clear();//rensa tidigare utseende
  80. while (V.slut == "1")
  81. {
  82.  
  83. for (V.i = 0; V.slut == "1"; V.i++)
  84. {
  85. Console.Clear();
  86. Console.ForegroundColor = ConsoleColor.DarkGray;
  87. Console.Write("{0, -10}" + "Lit", "");
  88. Console.ResetColor();
  89. Console.WriteLine("Bay v1.0");
  90. Console.WriteLine("________________________________");
  91. Console.WriteLine("");
  92. Console.WriteLine(" Dina uppgifter");
  93. Console.Write(" Namn: ");
  94. V.name[V.i] = Console.ReadLine(); //lägger namn till vektor "name"
  95.  
  96. Console.Write(" Boktitel: ");
  97. V.bokId[V.i] = Console.ReadLine();//lägger boknamn till vektor "bokId"
  98.  
  99. Console.Write(" Telefonnummer: ");
  100. V.tele[V.i] = Console.ReadLine();//lägger telefonnummer till vektor "tele"
  101.  
  102. Console.Write(" Kostnad: ");
  103. V.money[V.i] = Console.ReadLine();//lägger beloppet till vektor "money"
  104.  
  105. Console.Write(" Beskrivning: ");
  106. V.note[V.i] = Console.ReadLine();//lägger beskrivning för bok till vektor "note"
  107. Console.Clear();
  108. Console.ForegroundColor = ConsoleColor.DarkGray;
  109. Console.Write("{0, -10}" + "Lit", "");
  110. Console.ResetColor();
  111. Console.WriteLine("Bay v1.0");
  112. Console.WriteLine("________________________________\n");
  113. Console.WriteLine(" Din annons ligger nu uppe! "); //skapa en summa summarum av order info
  114. Console.WriteLine(" ");
  115. V.antal++;
  116.  
  117. Console.WriteLine(" Vill du göra en ny annons?\n");
  118. Console.WriteLine(" 1. Ja");
  119. Console.WriteLine(" 2. Nej");
  120.  
  121. while (!V.validInput)
  122. {
  123. V.slut = Console.ReadLine();
  124. if (!UInt32.TryParse(V.slut, out V.valOk))
  125. {
  126. Console.WriteLine("Fel inmatning!");
  127. }
  128. else if (V.valOk.Equals(0))
  129. {
  130. Console.WriteLine("Inmatat värde måste vara högre än noll.");
  131. }
  132. else
  133. {
  134. break;
  135. }
  136.  
  137.  
  138. }
  139. Console.Clear();
  140. }
  141.  
  142. }
  143. break;
  144.  
  145. case "2":
  146. // ta bort kod
  147. Console.Clear();
  148. break;
  149. }
  150. break;
  151.  
  152. case "2": // Köp litteratur
  153. Console.Clear();
  154. Console.ForegroundColor = ConsoleColor.DarkGray;
  155. Console.Write("{0, -10}" + "Lit", "");
  156. Console.ResetColor();
  157. Console.WriteLine("Bay v1.0");
  158. Console.WriteLine("________________________________\n");
  159. Console.WriteLine(" Lista över tillgänglig literatur.");
  160.  
  161. for (V.i = 0; V.i < V.antal; V.i++)
  162. {
  163. Console.WriteLine("");
  164. Console.WriteLine("------------------------------------------");
  165. Console.WriteLine("");
  166. Console.WriteLine(" Titel: " + V.bokId[V.i]);
  167. Console.WriteLine(" Beskrivning: " + V.note[V.i]);
  168. Console.WriteLine(" Pris: " + V.money[V.i]);
  169. Console.WriteLine(" Kontakt: " + V.name[V.i] + ", " + V.tele[V.i]);
  170.  
  171. }
  172. Console.WriteLine("\n Tryck valfri knapp för att gå till meny. ");
  173. Console.ReadKey();
  174. Console.Clear();
  175. break;
  176.  
  177. case "3": // Anslagstavlan
  178.  
  179. Console.Clear();
  180. Console.ForegroundColor = ConsoleColor.DarkGray;
  181. Console.Write("{0, -10}" + "Lit", "");
  182. Console.ResetColor();
  183. Console.WriteLine("Bay v1.0");
  184. Console.WriteLine("________________________________ \n");
  185. Console.WriteLine(" Välkommen till anslagstavlan!");
  186. Console.WriteLine(" 1. Skapa inlägg.");
  187. Console.WriteLine(" 2. Läs inlägg");
  188.  
  189. while (!V.validInput)
  190. {
  191. V.anslagVal = Console.ReadLine();
  192. if (!UInt32.TryParse(V.anslagVal, out V.valOk))
  193. {
  194. Console.WriteLine("Fel inmatning!");
  195. }
  196. else if (V.valOk.Equals(0))
  197. {
  198. Console.WriteLine("Inmatat värde måste vara högre än noll.");
  199. }
  200. else
  201. {
  202. break;
  203. }
  204.  
  205.  
  206. }
  207. Console.Clear();
  208.  
  209. switch (V.anslagVal)
  210. {
  211. case "1":
  212. while (V.anslagSlut == 1)
  213. {
  214.  
  215. for (V.i = 0; V.anslagSlut == 1; V.i++)
  216. {
  217. Console.Clear();
  218. Console.ForegroundColor = ConsoleColor.DarkGray;
  219. Console.Write("{0, -10}" + "Lit", "");
  220. Console.ResetColor();
  221. Console.WriteLine("Bay v1.0");
  222. Console.WriteLine("________________________________\n");
  223. Console.Write(" Ditt namn, telefonnummer: ");
  224. V.anslagNamn[V.i] = Console.ReadLine();
  225. Console.Write(" Meddelande: ");
  226. V.anslagMedd[V.i] = Console.ReadLine();
  227. V.anslagAntal++;
  228.  
  229. Console.Clear();
  230. Console.ForegroundColor = ConsoleColor.DarkGray;
  231. Console.Write("{0, -10}" + "Lit", "");
  232. Console.ResetColor();
  233. Console.WriteLine("Bay v1.0");
  234. Console.WriteLine("________________________________\n");
  235. Console.WriteLine(" Vill du göra ett nytt inlägg?");
  236. Console.WriteLine(" 1. Ja");
  237. Console.WriteLine(" 2. Nej");
  238. V.anslagSlut = int.Parse(Console.ReadLine());
  239. Console.Clear();
  240. }
  241. }
  242. break;
  243. case "2":
  244.  
  245. Console.ForegroundColor = ConsoleColor.DarkGray;
  246. Console.Write("{0, -10}" + "Lit", "");
  247. Console.ResetColor();
  248. Console.WriteLine("Bay v1.0");
  249. Console.WriteLine("________________________________\n");
  250. Console.WriteLine(" Lista över inlägg.");
  251. for (V.i = 0; V.i < V.anslagAntal; V.i++)
  252. {
  253. Console.WriteLine("");
  254. Console.WriteLine("________________________________\n");
  255. Console.WriteLine(" Skribent: " + V.anslagNamn[V.i]);
  256. Console.WriteLine(" Meddelande: " + V.anslagMedd[V.i]);
  257. }
  258. Console.WriteLine("\n Tryck valfri knapp för att gå tillbaka till menyn. \n ");
  259. Console.ReadKey();
  260. Console.Clear();
  261. break;
  262. }
  263. break;
  264. case "4":
  265.  
  266. Console.Clear();
  267. V.run = 2;
  268. break;
  269.  
  270. case "5":
  271. Console.WriteLine(". .,,*%#, ");
  272. Console.WriteLine(" ,(( ############### ");
  273. Console.WriteLine(" ############/ ###################( ");
  274. Console.WriteLine(" .%###%/ (###############* %##%. ####################### ");
  275. Console.WriteLine(" ########## *#.%* .################# .############* .########################## ");
  276. Console.WriteLine(" #############.#/ *##. ###### (###### ################## .####################### *#. ");
  277. Console.WriteLine(" ###########(.#*###((### ### ### *## / .############### ######## .####(* ## ");
  278. Console.WriteLine(" /#########(#####*#########. ### ## # #######/ ###### ### ## ");
  279. Console.WriteLine(" #%##* ########### ##( (# #. (##### (#######%( /###### ");
  280. Console.WriteLine(" ### ######### ##. . # ## ##### ############# (#####(. ##### ");
  281. Console.WriteLine(" (# ######## /## ######## ####### #, ##, .#### ############# ######### ##### ");
  282. Console.WriteLine(" ## .* ####### ## ########( ####### # ###########,*(########/,### ### *#### *#(. #### ");
  283. Console.WriteLine(" ## ######## *####### *###### #( / * #################### .*## ### ###( ");
  284. Console.WriteLine(" *# ######## /##### ###### / * #########* .###*/ ( (## ## .### ");
  285. Console.WriteLine(" # # #### # /######### ,#,## ,, , ############ ( # ## ");
  286. Console.WriteLine(" / # * ## # ############# /## . , ############## (## ## ");
  287. Console.WriteLine(" ########### # # #/*### .#(###### # #########,##( ################### #( ");
  288. Console.WriteLine(" ###########/ ,##/# # .####., ############### ##### ##########%* #/###( ");
  289. Console.WriteLine(" ###########/# (###* ### #### ######################### ,###########/ *####( ");
  290. Console.WriteLine(" *###########/ ##### ###* , # ################ ######### ###, ############ #### ## ");
  291. Console.WriteLine(" ,######## (#### ############## ###########.######%. ########### %####################### ## ");
  292. Console.WriteLine(" ################. (########## * ############.* , ##################################( ### ");
  293. Console.WriteLine(" * ################ #. ### ######### ############# ################################### , #### ");
  294. Console.WriteLine(" .##################### #### ######## /######## ############################################################ ##### ");
  295. Console.WriteLine(" #########################, ###################(######## ##/########################################################################( ");
  296. Console.WriteLine(" #############################/ .############################ ################################################################# ###########");
  297. Console.WriteLine("############################### ############################### /######################################################(# ./ #############");
  298. Console.WriteLine("#################################################################### ######################################################## /################");
  299. Console.WriteLine("###############################################################################################################################################################");
  300. Console.WriteLine("############( ############# ### .####################### /######################################### ## ############################# ############");
  301. Console.WriteLine("########### ### ####* ### # .* ####, ### # ### / .##. ## ,# * ## # ### ####### ###### ## # #### .#### ##. ###########");
  302. Console.WriteLine("########### ## ## ## ## %## # #. ## # #, ## # #. ## ,# #(# # #* ########## ,## ## # # ## # ######. ############");
  303. Console.WriteLine("########### #### #. ## ## ### .#/ # ###### ## ## .#( #. ## ,# ### *#, ####* ###### ###### ## ## # ########( #. ############");
  304. Console.WriteLine("############# #### ### # .#/ ##/ ## ## ## # ### ,# #### # ## .###### ###### ## ## ## .## ### (##########");
  305. Console.WriteLine("##################################################################################### ###################################################################");
  306. Console.WriteLine("###############################################################################################################################################################");
  307. Console.WriteLine("###############################################################################################################################################################");
  308. Console.ReadKey();
  309. break;
  310.  
  311.  
  312.  
  313. }
  314.  
  315.  
  316.  
  317. }
  318. }
  319. }
  320. }
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340. namespace Projekt_1
  341. {
  342. internal class V
  343. {
  344. public static bool validInput = false;
  345. public static uint valOk = 0;
  346. public static int anslagSlut = 1;
  347. public static int anslagAntal = 0;
  348. public static int antal = 0;
  349. public static int run = 1;
  350. public static string slut = "1";
  351. public static string val = "0";
  352. public static string annonsVal = "0";
  353. public static int köpVal = 0;
  354. public static string anslagVal = "0";
  355. public static int i = 0;
  356. public static string[] bokId = new string[10];
  357. public static string[] tele = new string[10];
  358. public static string[] name = new string[10];
  359. public static string[] note = new string[10];
  360. public static string[] money = new string[10];
  361. public static string[] anslagNamn = new string[10];
  362. public static string[] anslagMedd = new string[10];
  363.  
  364. }
  365. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement