c#的一个小问题

来源:百度知道 编辑:UC知道 时间:2024/05/07 09:40:11
using System;
class SortArray
{
int a;// Array size
void receive()//receive clata
{
Console.WriteLine("Please input the size of array");
n = Convert.ToInt32(Console.ReadLine());
int[] a = new int[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("Please input array element");
a = Convert.ToInt32(Console.ReadLine());
}
}
void sort(params int[] b)
{
int m = b.Length;
for(int i = 0;i<m;i++)
{
k = M-I;
for(intj;j<K-1;j++)
{
if(a[j]>a[j+1])

void sort(params int[] b)
{
for(int i = 0;i<b.Length-1;i++)
{

for(intj=i+1;j<b.Length;j++)
{
if(a[i]<a[j])
{int element;
element = a[j];
a[j] = a[i];
a[i] = element;
}
}
;

int[] a = new int[n];
是不是这里出的问题啊
你是不是该把这个N中的字符数取出来啊。

你的错误也太多了吧?首先C#是分大小写字母的,大写和小写是完全不同的。还有你第二个函数写的居然想直接用第一个函数的数组a,那是不可能的,你声明的数组b,应该比较数组b里面的大小,最上面的函数你声明了数组a,从键盘输入应该是 a[i],你却写a,估计你是想写a[i]把.
我把代码写好了,我在C#下面写的,调试没有错误你拿去对照吧!
class SortArray
{
int a;// Array size
void receive()//receive clata
{
Console.WriteLine("Please input the size of array");
int n = Convert.ToInt32(Console.ReadLine());
int[] a = new int[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("Please input array element");
a[i] =