Possible Duplicate:
Help converting type - cannot implicitly convert type ‘string’ to ‘bool’परोक्ष 'bool'
के प्रकार 'int' कनवर्ट नहीं कर सकता मैं बहुत भाषा के लिए नया हूँ n मैं एक अच्छा प्रोग्रामर नहीं हूँ। यह कोड मुझे त्रुटि दे रहा है:
cannot implicitly convert type int to 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)
{
numOfGuess++;
if (userInput = mag.randomMagnifier())
{
}
}
}
}
}
विभिन्न प्रकार, लेकिन एक ही विचार। * जहां * त्रुटि है पर ध्यान दें - यह आपको सीधे समस्या पर ले जाएगा। –
जहां आपने सीमा के लिए चर घोषित किया है OfGuess? – Nich
मैंने इसे एक कॉन्स के रूप में घोषित किया। कक्षा घोषणा के ठीक बाद। – user1730332