Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple loop in C#
Message
From
09/10/2006 10:16:15
Irv Adams
MSC Managed Care, Inc.
Florida, United States
 
 
To
09/10/2006 10:07:05
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01160532
Message ID:
01160543
Views:
15
>>I have a simple programming assignment I'm trying to help my daughter with, but I'm a helpless FoxPro addict and I'm not sure how to do this in C.
>>
>>She needs to write a loop to parse a string backwards, so 'Hello World' becomes 'dlroW olleH' and so on. Very simple, I could do it in my sleep in Fox, but I'm awake and I don't know much about C.
>>
>>Thanks,
>
>In C or C#?
>
>C#:
>
>
>			string source = "Hello World";
>			string result = String.Empty;
>			char[] srcArray = source.ToCharArray();
>
>			int i;
>
>			if (srcArray.Length > 0)
>			{
>				for (i=srcArray.Length-1;i>-1;i--)
>				{
>					result += srcArray[i];
>				}
>			}
>
>
>Straight C is a little more code. You have to use the string library (and header).

I'll have to ask her if it's C or C#. Thanks for your help!

Irv.
Previous
Reply
Map
View

Click here to load this message in the networking platform