Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
INTUIT: Laba#2; Данные для графика изменяняющейся функции
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here //arguments Console.WriteLine("Laba#2; " + "график изменяняющейся функции"); double n = 96; //количество итераций double Xn = -12, Xk = 12, dX = (Xk-Xn)/n; //диапазон активных данных double x = Xn; double z = 5; double a=-6, b=0, R = 3; // a - сдвиг по абсцисе, b - сдвиг по ординате, R-радиус. //execute for (int i=0; i<n; i++) { int ii=0; x = x+dX; Console.Write("dX=" + dX + "; "); if (Math.Abs(x)>9) {ii=0;} else if (x>=-9 && x<-6) {ii=1;} else if (x>=-6 && x<-3) {ii=2;} else if (x>=-3 && x< 0 ) {ii=3;} else if (x>=0 && x< 3 ) {ii=4;} else if (x>=3 && x<=9) {ii=5;} else {ii=6;} switch (ii) { case 0: z=0; Console.WriteLine("i={1,5}; x={2,20}; z={0,20}; ii={3,5}; Case_0" ,z,i,x,ii); break; case 1: a=-6; b=0; R = 3; Circle(a,b,R, x,ref z); Console.WriteLine("i={1,5}; x={2,20}; z={0,20}; ii={3,5}; F_Circle1" ,-z,i,x,ii); break; case 2: a=1; b=3; R = 3; Line(a,b,x,ref z);//Circle(a,b,R, x,ref z); Console.WriteLine("i={1,5}; x={2,20}; z={0,20}; ii={3,5}; F_line1" ,z,i,x,ii); break; case 3: a = 0; b = 0; Circle(a,b,R, x,ref z); Console.WriteLine("i={1,5}; x={2,20}; z={0,20}; ii={3,5}; F_Circle2" ,z,i,x,ii); break; case 4: a = -1; b = 3; Line(a,b, x,ref z); Console.WriteLine("i={1,5}; x={2,20}; z={0,20}; ii={3,5}; F_Line2" ,z,i,x,ii); break; case 5: a = 0.5; b = -1.5; Line(a,b, x,ref z); Console.WriteLine("i={1,5}; x={2,20}; z={0,20}; ii={3,5}; F_Line3" ,z,i,x,ii); break; default : Console.WriteLine("***"); break; } } } //FN public static double Circle(double a, double b, double R, double x, ref double z) { z = Math.Sqrt(R*R - (x-a)*(x-a)) + b; return z; } public static double Line(double a, double b, double x, ref double z) { z = a*x + b; return z; } } }
run
|
edit
|
history
|
help
0
Pascal Triangle
pattern
Vignere Cipher
foreach
saxasdcdf
Hello
nba
type comparison
QuickSort
lasses, properties, methods, ling begining