p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning C# 6.0 Programming with Visual Studio 2015 (http://p2p.wrox.com/forumdisplay.php?f=798)
-   -   Chapter 4 exercise 1 (http://p2p.wrox.com/showthread.php?t=99656)

markwharveyaprn October 20th, 2017 11:10 PM

Chapter 4 exercise 1
 
Here is how I got it to run, because it won't run the way that it is in the book:
Code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace Ch04Ex1
{
    class Program
    {
        static void Main(string[] args)
        {
            WriteLine("Enter an integer:  ");
            int myInt = Convert.ToInt32(ReadLine());
            bool isLessThan10 = myInt < 10;
            bool isBetween0and5 = (0 <= myInt) && (myInt <= 5);
            WriteLine($" Integer less than 10? {isLessThan10}");
            WriteLine($"Integer between 0 and 5? {isBetween0and5}");
            WriteLine ($"Exactly one of the above is true? { isLessThan10 ^ isBetween0and5}");
            ReadKey();

        }

        private static int ToInt32(string v)
        {
            throw new NotImplementedException();
        }
    }
}



All times are GMT -4. The time now is 07:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.