Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 16th, 2013, 10:09 PM
Authorized User
Points: 179, Level: 3
Points: 179, Level: 3 Points: 179, Level: 3 Points: 179, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson 19, FOR loops

What is this supposed to do? Open a Command Prompt window?

(top of page 230)


Code:
Console.WriteLine(string.Format("{0} : {1}", i , iSquared));
  #2 (permalink)  
Old June 16th, 2013, 11:59 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

That writes output into the Output window (aka the Console window). It's a quick way to display output without messing up the user interface.

If you can't find it, open the Debug menu's Windows submenu and select Output.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
  #3 (permalink)  
Old June 17th, 2013, 12:29 PM
Authorized User
Points: 179, Level: 3
Points: 179, Level: 3 Points: 179, Level: 3 Points: 179, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll try it.

What would be the practical application of doing this? Just as a test to see how the code works?
  #4 (permalink)  
Old June 17th, 2013, 12:41 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

For this example, the benefit is to see how the loop works. In fact, for any beginning programming book, the benefit of almost everything will be just to learn and understand techniques. You're not going to write a lot of production-quality code that is truly useful for real business situations until you finish the beginning book and start working on larger and more confusing projects. The examples in beginner's books usually focus on a single concept at a time and "real-world" project often require that you use lots of different techniques all at once. But it's very hard to learn by studying those kinds of projects.

I often write values into the Output window with Console.WriteLine to see what values my program is using. You can see the values by setting breakpoints but it's often easier to look at many values all at once in the OutputWindow.

For example,. I was recently trying to draw a graph showing several hundred data points and some were wrong. I could step through the code but I would need to step through hundreds of values to find the ones that were messed up. Instead I wrote their values into the Output window. Then I could look in the window to see where they went wrong more easily. That still didn't solve the problem but it helped me figure out where the values were getting messed up.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 19 Exercise 4 mpthemaster BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 3 June 11th, 2011 08:54 PM
break for-each loops, or limit amount of loops warhero XSLT 2 July 4th, 2007 02:18 AM
Two Loops iloveoatmeal Classic ASP Basics 5 September 26th, 2005 09:59 AM
While loops and For loops in XSLT spencer.clark XSLT 1 August 5th, 2005 09:50 AM
loops Hudson40 Access VBA 1 February 4th, 2005 12:58 PM



All times are GMT -4. The time now is 11:14 AM.


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