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: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4
This is the forum to discuss the Wrox book Beginning Microsoft Visual C# 2008 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780470191354
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 24th, 2009, 09:16 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Question Chapter 5 Question 5

I don't understand a bit if syntax in one of the question solutions.

You have to make a console application which reverses a strings order and the solution is here:

Code:
static void Main(string[] args)
        {
            Console.WriteLine("what is your name?");
            string input1;
            string reversedString = "";
            input1 = Console.ReadLine();
            for (int index = input1.Length -1; index >= 0; index --)
            {
                reversedString += input1[index];
            }
            Console.WriteLine("Your name reveresed is: {0}", reversedString);
            Console.ReadKey();

        }
Now I understand everything apart from the syntax of one line which I might have overlooked in the chapter but I browsed through and couldn't see it explained so a point in the right direction would be good.

The line I don't understand is:

Code:
reversedString += input1[index];
I get that it is saying find the character corresponding to the index number and place it in reversedString but I do not understand:

Code:
input1[index];
As I am going through this book intermitently I overlooked it at first and thought it was an explicit conversion but after thinking about it you still output a string so it isn't converting anything it is just assigning the letter based on its indexed value.

It just isn't described in the chapter from what I can see; how this works and what you can use it with so could anybody tell me what this is called/how it works or tell me where in the book it talks about this?
Reply With Quote
  #2 (permalink)  
Old October 24th, 2009, 09:18 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

I'm stupid ignore my question it's an array. Big brain fart.
Reply With Quote
Reply


Thread Tools
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
Question on Chapter 5 arholly BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 September 2nd, 2008 04:07 PM
Chapter 9 Small Question aspcoder BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 14 April 29th, 2008 01:51 PM
Chapter 4 question davidle1234 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 17th, 2007 11:18 PM
Another Chapter 12 Question doggiebore BOOK: Beginning Access 2003 VBA 1 September 29th, 2005 10:38 AM



All times are GMT -4. The time now is 02:14 PM.


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