Wrox Programmer Forums
| 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 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
  #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?
  #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.


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 18th, 2007 12:18 AM
Another Chapter 12 Question doggiebore BOOK: Beginning Access 2003 VBA 1 September 29th, 2005 10:38 AM





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