Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 21st, 2004, 09:21 AM
Authorized User
 
Join Date: Jul 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning Visual C# Exercises - Chapter 04

1. int varOne = 19;
        int varTwo = 20;
        bool test1 = varOne > 10 ^ varTwo > 10;

2. int varOne, varTwo;
        do
        {
            Console.WriteLine("Provide 2 numbers - one more than 10, the other between 1 and 10.");
            Console.WriteLine("Enter one of your numbers here:");
            varOne = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the other number here:");
            varTwo = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("You responded as requested: {0}", varOne > 10 ^ varTwo > 10);
            Console.WriteLine("");
        } while (! (varOne > 10 ^ varTwo > 10));

3. In the "If" condition, the single equal sign is an assignment operator and generates an error.
            Correct to a double equal sign for a comparison.

4. ... Insert into existing code Ch04Ex06 after "int iterations;" line
        // Maintain console window dimensions: 49 rows, 80 columns
        // Lose one row (49 -1) and column (80 -1) as starting points
        // Reduce imaginary input by 2.4 (48 rows * .05 step)
        double imagConstraint = 2.4;
        // Increase real input by 2.36 (79 columns * .03 step) - .01 [rounding adj]
        double realConstraint = 2.36;
        double realStart, imagStart;
        Console.WriteLine("Enter a two-place decimal number between -2.00 and 2.00");
        imagStart = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine("Enter a two-place decimal number between -2.00 and 2.00");
        realStart = Convert.ToDouble(Console.ReadLine());

        .... Replace (or rewrite) next two "for ..." lines
        //for (imagCoord = 1.2; imagCoord >= -1.2; imagCoord -= 0.05)
        for (imagCoord = imagStart; imagCoord >= imagStart - imagConstraint; imagCoord -= 0.05)
        {
            //for (realCoord = -0.6; realCoord <= 1.77; realCoord += 0.03)
            for (realCoord = realStart; realCoord <= realStart + realConstraint; realCoord += 0.03)
            {





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Visual C# Exercises - Chapter 15 seblake C# 1 September 17th, 2004 08:41 PM
Beginning Visual C# Exercises - Chapter 10 seblake C# 1 July 29th, 2004 05:10 PM
Beginning Visual C# Exercises - Chapter 09 seblake C# 0 July 27th, 2004 03:23 PM
Beginning Visual C# Exercises - Chapter 03 seblake C# 1 July 19th, 2004 09:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.