这是我的代码:
目的是添加两个大数字,首先在 2 个数组中输入两个数字,然后交换它们并添加它们,基于控制台,
我是 C# 的新手,所以请解释一下,记住我对代码的了解
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sum_Two_BIG_Numbes
{
public class matrix
{
public int[] c;
public void input(int[] a)
{
for (int i = 0; i < a.Length; i++)
{
a[i] = Convert.ToInt32(Console.ReadLine());
}
}
public void Jamk(int[] a, int[] b, int[] c)
{
for (int i = 0; i < a.Length; i++)
{
int temp = a[i] + b[i];
if ((temp < 10) && (c[i] != 1))
{
c[i] = c[i] + temp;
}
else
{
c[i] = c[i] + temp % 10;
c[i + 1] = c[i + 1] + temp / 10;
}
}
}
public void swap(int[] a)
{
for (int i = 0; i < a.Length; i++)
{
a[i] = a[a.Length - i];
}
}
}
class Program
{
public void Main(string[] args)
{
int[] a = new matrix();
//int[] a = new int[30];
int[] b = new int[30];
int[] c = new int[30];
Console.WriteLine("Enter First Number : ");
matrix.input(a);
Console.ReadLine();
}
}
}
我收到此错误“非静态字段需要对象引用......”