[ BaMak @ 19.04.2013. 20:32 ] @
Pozdrav svima, trebala bi mi hitna omoc da zavrsim ovaj projekt ako je ikako moguce. Napravio sam listu reci, mali meni, e sada treba mi da dovrsim to da klikom na brojem jedan dobijem mogucnost unosa novih reci, i da pri pritisku na broj tri tj samoj igri dodam funkciju da se rec ispise u minusima i prilikom svakog tacnog slova da se taj minus zameni slovom. Zahvaljujem unapred! Ovoliko je za sada uradjeno: Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace HängaGubbe { class Meny { static void Main(string[] args) { while (true) { Console.ForegroundColor = ConsoleColor.Yellow; //Meny Console.WriteLine("\n\n\t === HÄNGA GUBBE === \n\n"); Console.WriteLine("\n\n\t[1] Lägg till ord"); Console.WriteLine("\t[2] Lista alla ord"); Console.WriteLine("\t[3] Spela"); Console.WriteLine("\t[4] Avsluta"); Console.Write("\n\tVälj 1-4: "); //Användaren får välja string menySelection = Console.ReadLine(); if (menySelection == "1") { Console.WriteLine("\n\n\t=== LÄGG TILL ORD ===\n\t"); var input = Console.ReadLine(); showing.AddWord(input); break; } else if (menySelection == "2") { Console.WriteLine("\n\n\t=== ORDLISTA ===\n"); OrdL showing = new OrdL(); showing.OrdLista(); Console.WriteLine("\n\t=========="); } else if (menySelection == "3") { int guesses; Console.Write("\n\tHUR MÅNGA GÅNGER FÅR DU GISSA FEL? "); guesses = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("\n\n\t=== VÄLKOMMEN TILL SPELET! ==="); Console.WriteLine("\t=== GISSA DET HEMLIGA ORDET ===\n\n"); String input; bool wrong; int NumberOfTries = 0; do { Console.WriteLine("\n\n\tFEL: " + NumberOfTries + " / " + guesses + "\n"); Console.WriteLine("\n\tGISSADE BOKSTÄVER:\n"); Console.WriteLine("\n\tORD:\n"); Console.Write("\n\n\tGISSADE BOKSTÄVER: "); input = Console.ReadLine(); Console.Write("\n\n\t "); wrong = !input.Equals("") && !input.Equals("") && !input.Equals("") && !input.Equals(""); if (wrong) { NumberOfTries++; Console.WriteLine("\n\tFEL BOKSTAV " + "FÖRSÖK IGEN!"); } if (wrong && (NumberOfTries > guesses - 1)) { Console.WriteLine("\n\tDU HAR INTE LYCKATS, DU HADE " + guesses + " FEL!" + "\n\n"); break; } } while (wrong); if (!wrong) Console.WriteLine("\n\tGRATTIS DU HAR GISSAT RÄTT!"); } else if (menySelection == "4") { Console.WriteLine("\n\n\t=*= HEJ DÅ! =*=\n\n\n\n\n"); break; //avbryter while loopen, avslutar spelet } else { Console.WriteLine("\n\tOGILTIGT VAL!"); //meddelar vid fel val } } } } } Code: using System; using System.Collections.Generic; namespace HängaGubbe { class OrdL { private List<string> ord = new List<string>(); public void OrdLista() { ord.Add("\tprojektarbete"); ord.Add("\tntiskolan"); ord.Add("\tprogrammering"); ord.Sort(); foreach (string word in ord) { Console.WriteLine(word); } } public void AddWord(string value){ ord.Add(value); } } } |