错误:非静态的字段、方法或属性Program.F(ref int, ref int, ref int, ref int)”
using System;using System.Collections.Generic;
using System.Text;
namespace 自学
{
class Program
{
public void F(ref int x,ref int y,ref int z,ref int n)
{
for (int i = 0; i < n;i++ )
z = x * (1 + y);
}
static void Main(string[] args)
{
Console.WriteLine("请输入本金:");
int B = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入利率:");
int L = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入时间:");
int N = Convert.ToInt32(Console.ReadLine());
int Z=0;
F(ref B, ref L,ref Z,ref N);
Console.WriteLine("本利和为{0}", Z);
}
}
}