一般情况下,对数据进行翻转,就是输入的顺序与输出的顺序不一样。
比如下面这种情况:
Enter Number of Elements you Want to Hold in the Array ? 5 Enter Array Elements : 2 3 4 5 6 Reversed Array : Element is : 6 Element is : 5 Element is : 4 Element is : 3 Element is : 2
这里输入的是2、3、4、5、6,输出是倒序。
代码如下:
/*
* C# Program to Reverse a String with Predefined Function
*/
using System;
class linSearch
{
public static void Main()
{
Console.WriteLine("Enter Number of Elements you Want to Hold in the Array? ");
string s = Console.ReadLine();
int x = Int32.Parse(s);
int[] a = new int[x];
Console.WriteLine("\n Enter Array Elements : ");
for (int i = 0;