没有逻辑/语法错误的构建错误

时间:2016-07-27 20:58:00

标签: c# build

我开始创建一个命令行程序,允许我在Project Euler上完成问题4。

https://projecteuler.net/problem=4

当我正在编写程序脚本时,我决定调试(我正在使用Visual Studio Suite 2015)

当它开始时,会弹出一条消息,表明程序本身有“构建错误”。

我完全不知道发生了什么。

在下面的版本(C#)中,脚本没有逻辑错误,也没有语法错误。

你可以告诉我它有什么问题吗? 谢谢!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem_4
{
    class Program
    {

        static void Main(string[] args)
        {

            //Check Palindrome
            //Not complete code.

            int originalValue = 9009;
            int oppositeValue = 0; ;
            int carryOppositeValue;
            int placeValue = 0;
            bool completedCycle = false;
            int numCycles = 0;

            int numCycles2 = 0;

            int[] array = { 0 };

            for(placeValue = numCycles; completedCycle; placeValue++)
            {

                array[placeValue] = originalValue % 10;
                originalValue = originalValue / 10;

                if(originalValue >= 0)
                {

                    numCycles++;

                } else
                {

                    completedCycle = true;
                    Console.WriteLine("The number has " + numCycles + "Place Values");

                }

            }



            for(placeValue = 0; placeValue < 50; placeValue += 10)
            {

                if (numCycles2 == 0)
                {
                    oppositeValue = array[0];
                }
                else
                {
                    carryOppositeValue = placeValue * array[placeValue / 10];
                    oppositeValue += carryOppositeValue;
                }

            }

        }
    }
}

1 个答案:

答案 0 :(得分:0)

我编译了这段代码并且没有错误。我建议做一个构建/清理。

如果这不起作用,我会删除bin和obj文件夹,然后重新编译。

相关问题