本文介绍了将j设置为大于-等于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在行"j> = j * n"时遇到了一些问题
我收到以下错误:
I''m having some problems with the line "j >= j * n"
I get the following error:
Only assignment, call, increment, decrement, and new object expressions can be used as a statement.
我正在尝试增加 j .
and I am trying to, increment, j.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Functions
{
public class Factorial
{
// The "Calc" static method calculates the factorial value for the
// specified integer passed in:
public static int Calc(int i)
{
return ((i <= 1) ? 1 : (i * Calc(i - 1)));
}
}
}
namespace infini
{
class infini
{
static void Main(string[] args)
{
int n;
int j;
n = 3;
Dictionary<string, int> d =
new Dictionary<string, int>();
d.Add("A1", 0);
List<int> range = new List<int>();
for (int i = 1; i > 0; i++)
{
j = 1 - d["A1"] / Calc(n) ;
while ((i * j) < 1)
{
j >= j * n;
}
}
}
private static int Calc(int n)
{
throw new NotImplementedException();
}
public static int Factorial { get; set; }
}
}
推荐答案
j = j + 1; //Add 1 to j, and store that in j
j += 1; //Add one to j, and store it in j (shorthand notation)
j++; //Increment j with 1 (even shorter shorthand notation)
//Or with n
j += n; //Add n to j, and store in j(same as j = j + n)
j *= n; //Multiply j with n, and store in j (same as j = j * n)
希望这对您有所帮助,如果没有,请随时发表评论.
Hope this helps you on your way, if not, feel free to post a comment.
j >= j * n;
不是有效的声明.
您正在尝试做什么(您知道,您可以只使用(有效)语句
is NOT a valid statement.
What are you trying to do (you know, you may just use the (valid) statement
j++;
用于递增j
).
顺便说一句,没有 设置j
大于或等于i
" ,但只有 测试j
是否大于或等于i
" (至少在我所知道的编程语言中).
for incrementing j
).
BTW there is NO "setting j
greater than or equal to i
", but only "testing if j
is greater or equal to i
" (at least in the programming languages I know).
这篇关于将j设置为大于-等于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!