using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { StreamReader SR; StreamWriter SW; string DAY = null; string MONTH = null; string YEAR = null; string birthdate = null; int DAY1 = 0; int MONTH1 = 0; int YEAR1 = 0; SR = File.OpenText("DATA1.txt"); SW = File.CreateText("OUT1.txt"); for (int i = 0; i < 3; i++) { birthdate = SR.ReadLine(); DAY = birthdate.Substring(0, birthdate.IndexOf(" ")); birthdate = birthdate.Substring(birthdate.IndexOf(" ") +1, birthdate.Length-(birthdate.IndexOf(" ")+1)); MONTH = birthdate.Substring(0, birthdate.IndexOf(" ")); birthdate = birthdate.Substring(birthdate.IndexOf(" ") +1, birthdate.Length-(birthdate.IndexOf(" ")+1)); YEAR = birthdate.Substring(0, 4); YEAR1 = Convert.ToInt32(YEAR); MONTH1 = Convert.ToInt32(MONTH); DAY1 = Convert.ToInt32(DAY); if (YEAR1 > 1997 || YEAR1 ==1997 && MONTH1 > 10 || YEAR1 == 1997 && MONTH1 == 10 && DAY1 >27) { SW.WriteLine("too young"); } else { SW.WriteLine("old enough"); } } /* string firstline = SR.ReadLine(); string secondline = SR.ReadLine(); string thirdline = SR.ReadLine(); */ /* firstline = " " + "" + " " + "" + "dam"; secondline = " " + "" + " " + "" + " "; thirdline = " " + "" + " " + "" + " "; */ /* SW.WriteLine(firstline); SW.WriteLine(secondline); SW.WriteLine(thirdline); */ SW.Close(); SR.Close(); } } }