能直接给我完整代码吗?
时间: 2024-03-17 09:43:05 浏览: 19
当然可以,下面是完整的代码:
```csharp
using System;
namespace MyProgram
{
class Program
{
static void Main(string[] args)
{
// 测试 SolveQuadraticEquation 方法
double a = 2, b = 3, c = 4, x = 5;
double y = SolveQuadraticEquation(a, b, c, x);
Console.WriteLine($"y = {y}");
// 测试 PrintArray 方法
int[] arr = new int[] { 90, 80, 70, 60 };
PrintArray(arr);
}
public static double SolveQuadraticEquation(double a, double b, double c, double x)
{
return a * x * x + b * x + c;
}
public static void PrintArray(int[] arr)
{
for (int i = 0; i < arr.Length; i++)
{
Console.WriteLine($"下标为{i}的元素值为:{arr[i]}");
}
}
}
}
```
输出结果:
```
y = 69
下标为0的元素值为:90
下标为1的元素值为:80
下标为2的元素值为:70
下标为3的元素值为:60
```