Пример #1
0
        public static void Check()
        {
            bool isSafe = true;
            int  pressure;

            UserLib.WriteTitle("Pressure Check");

            while (isSafe)
            {
                pressure = UserLib.GetInt("Enter Pressure > ");

                if (pressure < LOW_PRESSURE)
                {
                    Console.WriteLine("Pressure is too low!");
                }
                else if ((pressure >= LOW_PRESSURE) && (pressure <= HIGH_PRESSURE))
                {
                    Console.WriteLine("Pressure is Normal!");
                }
                else if ((pressure > HIGH_PRESSURE) && (pressure < DANGEROUS_PRESSURE))
                {
                    Console.WriteLine("Pressure is too high!");
                }
                else if (pressure >= DANGEROUS_PRESSURE)
                {
                    Console.WriteLine("Pressure is DANGEROUS!");
                    isSafe = false;
                }
            }

            Console.WriteLine("Shut Down!!!");
        }
        public void InputValues()
        {
            UserLib.WriteTitle("Game Score");

            player   = UserLib.GetString("Your name > ");
            aliens   = UserLib.GetInt("How many aliens have you killed > ");
            treasure = UserLib.GetInt("How much treasure have you found > ");
            hours    = UserLib.GetInt("How many hours did you play > ");
        }
Пример #3
0
        /// <summary>
        /// This method will repeatedly ask the user to vote for one
        /// of the top ten songs. It will store that vote in a votes
        /// array.
        /// </summary>
        public void GetVote()
        {
            int songNo;

            UserLib.WriteTitle("Top 10 MP3 Songs");
            do
            {
                songNo = UserLib.GetInt("Choose 1 - " + songs.Count() + " > ");

                if (songNo > 0 && songNo <= MAXN_SONGS)
                {
                    votes[songNo - 1]++;
                    Show();
                }
                else
                {
                    Console.WriteLine();
                    Console.WriteLine("Song " + songNo + "does not exists!");
                }
                Show();
            } while (songNo != 0);
        }