private static void MeniuProfile() //afisarea meniului Profile Info { Console.Clear(); Console.WriteLine("PROFILE INFO\n"); Console.WriteLine("1. Info"); Console.WriteLine("2. Delete account"); Console.WriteLine("3. Logout"); Console.WriteLine("4. Back"); switch (Console.ReadKey(true).KeyChar) { case '1': { Afisare.ShowStatsHero(); MeniuPrincipal(); break; } case '2': { string path = Hero.Instance.Name + ".xml"; if (File.Exists(path)) { File.Delete(path); } Console.Clear(); Console.WriteLine("Account deleted..."); Console.WriteLine("\nPress any key to go back..."); Console.ReadKey(); Meniu.MeniuLogin(); break; } case '3': { Meniu.MeniuLogin(); break; } case '4': { MeniuPrincipal(); break; } default: { MeniuProfile(); break; } } }
static void Main(string[] args) { string[] numeCursuri = new[] { "EUR", "USD" }; //declaram o matrice cu 2 linii (EUR, USD) si un numar de coloane egal cu numarul lunii curente decimal[,] cursValutar = new decimal[2, DateTime.Today.Month]; //populam matricea for (int i = 0; i < cursValutar.GetLength(0); i++) { for (int j = 0; j < cursValutar.GetLength(1); j++) { //afisam mesaj utilizatorului Console.WriteLine("Introduceti cursul valutar " + numeCursuri[i] + " pentru luna " + (j + 1)); //Console.WriteLine("Introduceti cursul valutar " + (i == 0 ? "EUR" : "USD") + " pentru luna " + (j + 1)); //preluam cursul pentru fiecare valuta (linie) si fiecare luna (coloana cursValutar[i, j] = decimal.Parse(Console.ReadLine()); } } //aflam lunile pentru care cursurile sunt diferite si lunile pentru care sunt egale //declaram un vector pentru a stoca lunile care au cursuri diferite int[] cursuriDiferite = new int[0]; //declaram un vector pentru a stoca lunile care au cursuri egale int[] cursuriEgale = new int[0]; for (int i = 0; i < cursValutar.GetLength(1); i++) { //testam (in)egalitatea cursurilor if (cursValutar[0, i] != cursValutar[1, i]) { Array.Resize(ref cursuriDiferite, cursuriDiferite.Length + 1); cursuriDiferite[cursuriDiferite.Length - 1] = i + 1; } else { Array.Resize(ref cursuriEgale, cursuriEgale.Length + 1); cursuriEgale[cursuriEgale.Length - 1] = i + 1; } } //afisam lunile utilizand o functie utilitara definita in proiectul IE.Prog1.Util Afisare.AfisareLuni(cursuriDiferite, "cu cursuri diferite"); Afisare.AfisareLuni(cursuriEgale, "cu cursuri egale"); Console.ReadKey(); }
static void Main(string[] args) { decimal[] cursValutar = new decimal[DateTime.Today.Month]; //cerem valori de la utilizator Console.WriteLine("Introduceti curs EUR"); for (int i = 0; i < cursValutar.Length; i++) { Console.WriteLine("Pentru luna: " + (i + 1)); cursValutar[i] = decimal.Parse(Console.ReadLine()); } decimal suma = 0; decimal minim = cursValutar[0]; decimal maxim = cursValutar[0]; //decimal pminim = 0; //decimal pmaxim = 0; for (int i = 0; i < cursValutar.Length; i++) { suma = suma + cursValutar[i]; if (cursValutar[i] < minim) { minim = cursValutar[i]; //pminim = i; } if (cursValutar[i] > maxim) { maxim = cursValutar[i]; //pmaxim = i; } } decimal media = suma / cursValutar.Length; int[] luniMax = new int[0]; int[] luniMin = new int[0]; int[] luniPesteMedie = new int[0]; int j = 0; while (j < cursValutar.Length) { if (cursValutar[j] == minim) { Array.Resize(ref luniMin, luniMin.Length + 1); luniMin[luniMin.Length - 1] = j; } if (cursValutar[j] == maxim) { Array.Resize(ref luniMax, luniMax.Length + 1); luniMax[luniMax.Length - 1] = j; } if (cursValutar[j] > media) { Array.Resize(ref luniPesteMedie, luniPesteMedie.Length + 1); luniPesteMedie[luniPesteMedie.Length - 1] = j; } j++; } Console.WriteLine("Media este " + media); //apelam functia de afisare Afisare.AfisareLuni(luniMin, "de minim"); Afisare.AfisareLuni(luniMax, "de maxim"); Afisare.AfisareLuni(luniPesteMedie, "peste medie"); Console.ReadKey(); }
public static void StartBattle() { if (Hero.Instance.Level == 1) { Hero.Instance.HP = 500; Hero.Instance.Damage = 50; } List <Enemy> en = new List <Enemy>(); int EnemiesNr = Hero.Instance.GameLevel + 2; for (int i = 0; i < EnemiesNr; i++) { en.Add(new Enemy()); } while (true) // (hero.HP > 0) // am facut asa pt ca la noi totul este verificat si el stie cand trebuie sa intrerupa loop-ul prin break { if (en[0].HP <= 0) //cand il maceste pe un enemy { en.RemoveAt(0); Console.Clear(); Afisare.EnemyDestroyed(); Thread.Sleep(1000); //1000 Console.Clear(); Hero.Instance.Exp += 10; if (Hero.Instance.Exp >= Hero.Instance.Exp_Per_Level) { Hero.Instance.Level++; Hero.Instance.Exp_Per_Level = Hero.Instance.Exp_Per_Level * 2 + (Hero.Instance.Exp_Per_Level / 4); } if (en.Count == 0) { Hero.Instance.HP = 500 + (200 * (Hero.Instance.Level / 10)); Hero.Instance.SaveHero(); Hero.Instance.GameLevel++; Afisare.WinMessage(); Thread.Sleep(1500); //hero.Level++; NextLevel.LevelNext(); break; } } else { Console.Clear(); Afisare.ShowScreen(Hero.Instance.Name, Hero.Instance.HP, en[0].HP, Hero.Instance.Level, Hero.Instance.Exp, en.Count); Hero.Instance.HP -= en[0].Damage; Thread.Sleep(1000); //1000 en[0].HP -= Hero.Instance.Damage; Console.Clear(); Afisare.ShowScreen(Hero.Instance.Name, Hero.Instance.HP, en[0].HP, Hero.Instance.Level, Hero.Instance.Exp, en.Count); Thread.Sleep(1000); //1000 } if (Hero.Instance.HP < 0) { Hero.Instance.HP = 500 + (200 * (Hero.Instance.Level / 10)); Hero.Instance.SaveHero(); Afisare.LostMessage(); Thread.Sleep(1500); Meniu.MeniuPrincipal(); break; } } //while }