Почему выдает предупреждения? - C#
Формулировка задачи:
/*
* Created by SharpDevelop.
* User: 26-60-911
* Date: 13.08.2017
* Time: 20:58
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace Алгоритм_Брезенхема
{
class Program
{
public static void Main(string[] args)
{
Console.Title = "Console";
int x = 10;
int y = 10;
int x1 = 30;
int y1 = 20;
int incX, incY;
int errorX, errorY;
int currentX, currentY;
int dx = x1 - x;
int dy = y1 - y;
if (dx > 0) { incX = 1; }
else { if (dx == 0) { incX = 0; } else { incX = -1; }}
if (dy > 0) { incY = 1; }
else { if (dy == 0) { incY = 0; } else { incY = -1; }}
dx = System.Math.Abs(dx);
dy = System.Math.Abs(dy);
int L = System.Math.Max(dx, dy);
errorX = x;
errorY = y;
currentX = x;
currentY = y;
while ((currentX != x1) || (currentY != y1))
{
errorX += dx;
errorY += dy;
System.Console.SetCursorPosition(currentX, currentY);
System.Console.Write('X');
if (errorX > L)
{
errorX -= L;
currentX += 1;
}
if (errorY > L)
{
errorY -= L;
currentY += 1;
}
}
Console.ReadKey(true);
}
}
}Решение задачи: «Почему выдает предупреждения?»
textual
Листинг программы
if (errorX > L)
{
errorX -= L;
currentX += incX;
}
if (errorY > L)
{
errorY -= L;
currentY += incY;
}