CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Empty console window?

    Hello everybody
    I am reading a book by Rob miles.
    I'm new to programming, entered this code
    Code:
    using System;
    class GlazerCalc
    {
    static void Main()
    {
    double width, height, woodLength, glassArea;
    string widthString, heightString;
    widthString = Console.ReadLine();
    width = double.Parse(widthString);
    heightString = Console.ReadLine();
    height = double.Parse(heightString);
    woodLength = 2 * ( width + height ) * 3.25 ;
    glassArea = 2 * ( width * height ) ;
    Console.WriteLine ( "The length of the wood is " +
    woodLength + " feet" ) ;
    Console.WriteLine( "The area of the glass is " +
    glassArea + " square metres" ) ;
    }
    }
    And when I pressed F5, an empty console window popped up..
    What seems to be the problem? Thank you.

  2. #2
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Empty console window?

    I only had a quick look at the code, but, could it be that the line
    widthString = Console.ReadLine();
    is hit, and that the console is simply waiting for some input? (enter some value and press the enter key)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured