using System using System Collections Generic using System Linq using

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void print(List<string> name, List<string> X, List<string> Y, List<string> F)
{
double XMax = 0;
double YMax = 0;
double FMax = 0;
for (int i = 0; i < X.Count; i++)
{
if (X[i].Length > XMax)
XMax = X[i].Length;
if (Y[i].Length > YMax)
YMax = Y[i].Length;
if (F[i].Length > FMax)
FMax = F[i].Length;
}
for (int i = 0; i < X.Count; i++)
{
while (X[i].Length < XMax)
X[i] = X[i] + " ";
while (Y[i].Length < YMax)
Y[i] = Y[i] + " ";
while (F[i].Length < FMax)
F[i] = F[i] + " ";
}
for (int i = 0; i < X.Count; i++)
{
Console.Write(F[i] + " ");
Console.Write(X[i] + " ");
Console.Write(Y[i] + " ");
Console.WriteLine();
}
}
static void Main(string[] args)
{
int a = 0;
double b = 0.9;
double x = a;
double h = 0.3;
double y0 = 0.6;
double y = y0;
int i = 0;
double f = 15 - 1 / 3 * y0;
Console.WriteLine("F x y");
do
{
x = a + h * i;
y = y + f * x;
f = 15 - y / 3;
i++;
var name = new List<string>();
name.Add("f");
name.Add("x");
name.Add("y");
var X = new List<string>();
var Y = new List<string>();
var F = new List<string>();
X.Add(x.ToString());
Y.Add(y.ToString());
F.Add(f.ToString());
print(name, X, Y, F);
} while (x+0.00001 < b);
}
}
}