2016-07-27 112 views
0

我开始创建一个命令行程序,允许我在Project Euler上完成问题4。内部错误,没有逻辑/语法错误

https://projecteuler.net/problem=4

当我在编写脚本程序的中间,我决定调试(我使用Visual Studio 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; 
       } 

      } 

     } 
    } 
} 
+0

对不起,没有添加评论...如果它会帮助,我可以把它们放在... –

回答

0

我编译了这段代码,没有遇到任何错误。我会建议做一个建设/清洁。

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

+0

谢谢!它现在很好用! –