嗨,我是一位入门C#课程的完整入门者。无论我输入什么内容,我都会不断收到以下代码的“意外符号”错误。有人可以建议吗?非常感谢!
C#:
/// <summary>
/// Programming Assignment 1
/// </summary>
class Program
{
// x and y coordinates for points
static float point1X;
static float point1Y;
static float point2X;
static float point2Y;
/// <summary>
/// Calculates angle and distance between two points
/// </summary>
/// <param name="args">command-line args</param>
static void Main(string[] args)
{
// loop while there's more input
string input = Console.ReadLine();
while (input[0] != 'q')
{
// extract point coordinates from string
GetInputValuesFromString(input);
// Add your code between this comment
// and the comment below. You can of
// course add more space between the
// comments as needed
float X1=2, Y1=2, X2=1, Y2=1
//calculate the delta x and delta y between the two points
float deltaX = Math.Pow((X2-X1);
float deltaY = Math.Pow((Y2 - Y1) ,
//pythagoras theorem for distance
变种 = Math.Sqrt(deltaY + deltaX),
//atan2 for angle
float radians = Math.Atan2((Y2 - Y1), (X2 - X1));
//radians into degrees
变种 angle = radians * (180 / Math.PI);
WriteLine(Dist = + distance);
WriteLine(angle = + angle);
由主持人最后编辑: