Feb 11, 2002 #1 Grizant Programmer Joined Oct 6, 2002 Messages 7 Location US If you ask for an inputed number which is classified as int, how would you reverse the order of those numbers using functions. EX) 8374 to 4738.
If you ask for an inputed number which is classified as int, how would you reverse the order of those numbers using functions. EX) 8374 to 4738.
Feb 12, 2002 #2 sjc IS-IT--Management Joined Jun 7, 2001 Messages 41 Location GB You could always use the ToString method of the Int class and then using basic string manipulation in a For loop, reverse it that way. Upvote 0 Downvote
You could always use the ToString method of the Int class and then using basic string manipulation in a For loop, reverse it that way.
Feb 14, 2002 #3 chiph Programmer Joined Jun 9, 1999 Messages 9,878 Location US Try this: Code: String MyString = new String("4567"); Array myArray=Array.CreateInstance(typeof(Char), 4); for (int i = myArray.GetLowerBound(0); i <= myArray.GetUpperBound(0); i++) { myArray.SetValue(MyString.Char(i), i); } Array.Reverse(myArray); Chip H. Upvote 0 Downvote
Try this: Code: String MyString = new String("4567"); Array myArray=Array.CreateInstance(typeof(Char), 4); for (int i = myArray.GetLowerBound(0); i <= myArray.GetUpperBound(0); i++) { myArray.SetValue(MyString.Char(i), i); } Array.Reverse(myArray); Chip H.