Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple loop in C#
Message
From
09/10/2006 10:25:49
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:
01160544
Views:
25
>>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).

Keith,

Just in case I don't receive a reply from her regarding C-version, can you outline the same procedure in straight C?

Thanks,

Irv.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform