小编use*_*332的帖子

无法将类型'int'隐式转换为'bool'

可能重复:
帮助转换类型 - 无法将类型'string'隐式转换为'bool'

我对语言很新,我不是一个优秀的程序员.这段代码给了我错误:

不能将int类型隐式转换为bool.

我不确定我做错了什么.有些人可以告诉我我做错了什么.任何建议也会有所帮助.

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

   namespace ConsoleApplication2
   {
     class mysteryVal
  {
   public const int limitOfGuess = 5;

  // Data member
    public int mystVal;
         private int numOfGuess ;
      private randomNumberMagnifier mag = new randomNumberMagnifier();

      public int randomMag(int num)
     {
        return num + mystVal;
      }

     // Instance Constructor
     public mysteryVal()
     {
        mystVal = 0;
         numOfGuess = 0;
            }

           public void game(int user)
          {
              int userInput = user;
               if (numOfGuess < limitOfGuess)
                     { …
Run Code Online (Sandbox Code Playgroud)

c#

6
推荐指数
2
解决办法
5万
查看次数

标签 统计

c# ×1