2016-07-27 108 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

謝謝!它現在很好用! –