0

这是我的问题,如何从 Visual C++ 中的文本框输入解析字符串。我有这样的项目,我的投入需要一年。无论是否是闰年,该程序都会在标签中给出结果。我擅长 C++/CLI,但 Visual 有点不同。请在这里真的需要帮助。

这是部分代码:

      String ^ year;
      year = textBox1->Text;

     // The code for parsing will be put here

      bool isLeapYear = ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0));

             if (isLeapYear)
             {
                label1->Text="Is a leap year";
             } else
                label1->Text="Is not a leap year";
             }
4

1 回答 1

0

查看 .NET System.Convert类以从一种类型转换为另一种类型。

于 2013-03-05T00:59:43.617 回答