19 Şubat 2015 Perşembe

Csharp'ta Bool Örneği (True-False) -Are you Major? -41

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication19 { class Program { static void Main(string[] args) { Person person = new Person(); Console.WriteLine("Welcome, or Wellcome!"); Console.Write("Print your name please: "); person.Name = Console.ReadLine(); Console.Write("Print you surname please: "); person.Surname = Console.ReadLine(); Console.Write("Are you Major: "); var answer = Console.ReadLine().ToUpper(); Console.WriteLine("Thanks. The system will check if you are the Major or not. Please wait!"); Console.WriteLine("\n... \n...\n..."); if (answer == "YES") { person.AreYouMajor = true; Console.WriteLine("Gratz {0}, you are the Major! Salute!", person.Name); } if (answer == "NO") { person.AreYouMajor = false; Console.WriteLine("Sorry You are'nt the Major that i am looking for. Please become a Major or leave me alone!"); } if (answer != "YES" & answer != "NO") { Console.WriteLine("We could'nt solve what you are. Go away please!"); } Console.ReadKey(); } public class Person { public string Name; public string Surname; public bool AreYouMajor; } } }

Hiç yorum yok:

Yorum Gönder