我昨天問這樣的問題,但我沒有得到關於它的編譯器錯誤:運算符「*」和「+」無法應用於
在下面,爲什麼我不能使用*代碼和+在最後一行很好的答案? ?和最新的方式來解決,多虧
private void bigzarb(int u,int v)
{
double n;
int x=0;
int y;
int w=0;
int z;
string[] i = textBox7.Text.Split(',');
int[] nums = new int[i.Length];
for (int counter = 0; counter < i.Length; counter++)
{
nums[counter] = Convert.ToInt32(i[counter]);
}
u = nums[0];
double firstdigits =Math.Floor(Math.Log10(u) + 1);
v = nums[1];
double seconddigits = Math.Floor(Math.Log10(v) + 1);
if (firstdigits >= seconddigits)
{
n = firstdigits;
}
else
{
n = seconddigits;
}
if (u == 0 || v == 0)
{
MessageBox.Show("the Multiply is 0");
}
string threshold = textBox9.Text;
int intthreshold = Convert.ToInt32(threshold);
int intn = Convert.ToInt32(n);
if (intn <= intthreshold)
{
double uv = u * v;
string struv = uv.ToString();
MessageBox.Show(struv);
}
else
{
int m =Convert.ToInt32(Math.Floor(n/2));
x = u % 10^m;
y = u/10^m;
w = v % 10^m;
z = v/10^m;
bigzarb(x, w) *(10^m) +(bigzarb(x,w)+bigzarb(w,y))*10^m +bigzarb(y,z);///compiler gives error operator "*"and"+" cannot be applied to operands of type'void'and'int'
///and compiler gives error operator "*"and"+" cannot be applied to operands of type 'void' and 'void'
}
}
哇,你解釋清楚,現在我應該肯定定義返回?因爲我想在按鈕事件處理程序中使用此代碼,並且我們不能使用return – Arash 2010-12-20 08:05:39
非常感謝,我會詢問有關實現返回的其他問題 – Arash 2010-12-20 08:17:30